You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Dan Allen <da...@mojavelinux.com> on 2003/03/24 18:59:43 UTC

getting id of MAX entry

This is sort of more SQL related, but how would you find the id of
the record that is returned as the MAX() of another column.  For
instance, just say I had events that occured at all different times.
I wanted to find the most recent event.  I would do

select MAX(date) from table;

but now I want something like

select event_id, MAX(date) from table;

naturally that gives a mix error, so what would I do?

I could always query again with the result of the MAX(date) used the
next query, but I can't seem to use MAX in the where clause either.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Chaos reigns within. 
Reflect, repent, and reboot.  Order shall return.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -