for loop type query in mysql
Posted on 2009-05-12
I have a table ('metrics') which has fields "code" and "date".
There are a number of codes and a number of dates for each code.
I am using MySQL 5.1 and am intending on doing this a select query only.
basically, I want a distinct list of codes with the latest date for each one.
I thought it would be easy, but after procedures, sub queries, max, distinct, and so on I still can't seem to get it to work.
I've searched the interwebs and there seem to be loads of solutions, but none that actually work.
Thanks for any help you can give me,