On Thu, 21 Dec 2000, JCampbell wrote:
> I want to know if it is possible to build a MySQL query which will only
> return the unique values of a specific column. Ie if I had this table:
>
> id | name |date_______
> 1 | Jon | 2001-01-03
> 2 | Bob | 2001-01-04
> 3 | Jon | 2001-01-05
>
> Is there any SQL query that will only return 1 row for each value in the
> name column, or would I have to do that in PHP?
If I got you correctly:
select DISTINCT name from table;
If I didn't get you correctly, then maybe you meant: return the names that exist only
once in the table:
select name from table group by name having count(*)=1;
If I'm still not getting you correctly, then I must have a communication problem ;-)
regards,
thalis
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php