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 wro

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

2002-04-04 Thread Gurhan Ozen
Anthony, Is all the information you need to retrieve in one table? If yes , I don't think you have to do join to get the row you want.. you should be able to do it by: SELECT columns FROM table WHERE id=yourid AND DATE => 'date' ORDER BY DATE LIMIT 1; Is this what you are asking? And I think it

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

2002-04-04 Thread Rick Emery
SELECT * FROM mytable WHERE date_field 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 trying to figure out the best way to select the row of data for a specific id that is the most rece

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 LIM