OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
unique by field issue

From: Seth Leonard (sethsethleonard.com)
Date: Fri Jul 01 2005 - 15:43:05 CDT


I constantly bump up against this issue and am looking for a good
solution. I want a query that will return multiple rows, but only one
row per unique identifier in one field.

For instance, if I have the following table:

Name | Food | Eat_Date
Bob | Hot Dog | 2005-06-25
Jan | Pizza | 2005-06-27
Jim | Salad | 2005-05-25
Bob | Soup | 2005-06-03
Ann | Toast | 2005-06-13
Jim | Pizza | 2005-06-28

I want to be able to pull the most recent food by each name without
running multiple queries. I need a query that would give the results:

Bob | Hot Dog | 2005-06-25
Jan | Pizza | 2005-06-27
Ann | Toast | 2005-06-13
Jim | Pizza | 2005-06-28

Anyone have ideas of how to do this in one query?

Thanks,
Seth

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql