Re: Check for doubleposts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux