how can i get records by the latest date. ie. select last inserted records. mysql db structure below
desired results
I used below code, iam not sure whether it's the right approach.
Code:
timestamp method id comment 2009-01-10 getThud 16 "....." 2009-01-10 getFoo 12 "....." 2009-01-10 getBar 12 "....." 2009-01-11 getFoo 12 "....." 2009-01-11 getBar 12 "....."
Code:
timestamp method id comment 2009-01-10 getThud 16 "....." 2009-01-11 getFoo 12 "....." 2009-01-11 getBar 12 "....."
Code:
select max(timestamp),method,id from tables where 1 group by method,id order by timestamp desc
Comment