Tewfic,
Tuesday, October 01, 2002, 12:21:09 AM, you wrote:

TK> Hello, I have a table that keeps track of people and their office visits.
TK> This table will have duplicates since people will visit the office more than
TK> once...

TK> How can I get a list of people and the most recent time they've visited the
TK> office?

TK> Currently, I use 
TK> select * from table_name where date < '2002-06-18';
TK> but that gives me a list that includes duplicate people, if I use 'group by
TK> name' it give me the first listing of that person, which may not be the most
TK> recent...

SELECT *, MAX(date)
FROM table_name
WHERE date< '2002-06-18'
GROUP BY name;



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




---------------------------------------------------------------------
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

Reply via email to