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 wrote: > * 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 1 > > -- > Roger > query > > --------------------------------------------------------------------- > 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 > -- ___ __ __ __ _ _ ____ _ _ ____ ____ / __)( )( ) /__\( \/ )( ___) ( \( )( ___)(_ _) \__ \ )(__)( /(__)\\ / )__) ) ( )__) )( (___/(______)(__)(__)\/ (____)()(_)\_)(____) (__) You can't jump a canyon in two leaps. --------------------------------------------------------------------- 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