Re: Check for doubleposts
| From: | Richard Lynch | Date: | Fri, 06 May 2005 06:07:23 +0000 |
| Subject: | Re: Check for doubleposts | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-214596@lists.php.net to get a copy of this message | ||
On Tue, May 3, 2005 9:48 am, Fredrik Arild Takle said:
> what is the easiest way to check if a person i registered twice in a
> mysql-table. Lets assume that I only check if the last name is in the
> table
> more than once. This is in mysql 4.0 (subquery not an option).
>
> Do I have to use arrays and in_array. Or is there a more elegant solution?
If the GROUP BY and HAVING solution doesn't thrill you (and I thought it
was quite nice and elegant) you could go with Ye Olde Standard Answer:
select * from user_table as a, user_table as b where a.lastname =
b.lastname and a.user_id != b.user_id
You can use a.user_id < b.user_id to see only the one duplication.
--
Like Music?
http://l-i-e.com/artists.htm