RE: Getting the most recent record per id before date X

2002-04-04 Thread Roger Baklund
* Anthony R. J. Ball I am trying to figure out the best way to select the row of data for a specific id that is the most recent entry on or before a specific date. What about: SELECT * FROM table WHERE id = $specific_id AND date = '$specific_date' ORDER BY date DESC LIMIT

RE: Getting the most recent record per id before date X

2002-04-04 Thread Rick Emery
SELECT * FROM mytable WHERE date_field now() id_field=ID ORDER BY date_field DESC -Original Message- From: Anthony R. J. Ball [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 10:30 AM To: [EMAIL PROTECTED] Subject: Getting the most recent record per id before date X I am

Re: Getting the most recent record per id before date X

2002-04-04 Thread Anthony R. J. Ball
Ack, sorry (to you and Gurhan)... I've done this trick, but I was actually looking at it with more than one ID, hence the group by... either select from a whole table for a date or joining against another table with the desired ids... On Thu, Apr 04, 2002 at 06:59:30PM +0200, Roger Baklund