I have a table which contains records
id note date timestamp
1 ABCD 2014-08-18 2014-08-18 08:33:49
2 ABCDE 2014-08-18 2014-08-18 08:33:49
3 ABCDEF 2014-08-19 2014-08-18 08:33:49
4 XYZ 2014-08-19 2014-08-19 15:25:15
5 ABCD 2014-08-20 2014-08-19 15:25:15
6 ABCD 2014-08-19 2014-08-20 19:30:02
I need to group on "note" & select values created by last timestamp.
My expected output should be:
id note date timestamp
2 ABCDE 2014-08-18 2014-08-18 08:33:49
3 ABCDEF 2014-08-19 2014-08-18 08:33:49
4 XYZ 2014-08-19 2014-08-19 15:25:15
6 ABCD 2014-08-19 2014-08-20 19:30:02
I am using query
SELECT Field1, Field2, Max(TimeStamp) maxTime FROM table GROUP BY Field1
from post "MySQL Select Group of Records Based on latest timestamp"
But the query selects last time stamp, but the date field will be of previous record..
Please check the SQL fiddle :http://sqlfiddle.com/#!2/92a0ab/1 and let me know where i am wrong, or can somebody help me with correct query!!!