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.
I realize that I could create a temp table and select where date <= X and group by id, inserting the max date into the table with the id, then do a join... but I am wondering if the thought I had would be a really nasty sneaky trick to do it in one query... As far as I can tell, group by returns the first row as it is ordered by the key? If this is true would it be possible to design the keying for this special case, such that the field I wanted would rise to the top in a normal group by? or am I being a heretic and shold buy a stone proof suit? Just one of those things I have to check up on... :) -- ___ __ __ __ _ _ ____ _ _ ____ ____ / __)( )( ) /__\( \/ )( ___) ( \( )( ___)(_ _) \__ \ )(__)( /(__)\\ / )__) ) ( )__) )( (___/(______)(__)(__)\/ (____)()(_)\_)(____) (__) Guess it's time for Plan B, huh? --------------------------------------------------------------------- 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