Perhaps using Group BY would work. You could also do something like,
Select event_id from table where event_date = (select max(event_date) from table). Although I've never used it, and I'm not sure whether this is standard, but there is a "Limit" keyword in some dbs. Jim -----Original Message----- From: Dan Allen [mailto:[EMAIL PROTECTED] Sent: Monday, March 24, 2003 11:00 AM To: [EMAIL PROTECTED] Subject: 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, <[EMAIL PROTECTED]> http://www.mojavelinux.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Chaos reigns within. Reflect, repent, and reboot. Order shall return. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
