I have a mysql table with the following structure and data. I want to show last inserted record on any id.
id lc_counter lc_timestamp
1 15 2013-03-01 11:54:43
1 13 2013-03-01 11:48:56
10 7 2013-03-01 11:54:43
10 5 2013-03-01 11:48:56
100 5 2013-03-01 11:54:43
100 3 2013-03-01 11:54:43
SELECT inv_id, lc_counter, lc_timestamp
FROM link_counter
group by inv_id
order by inv_id asc, lc_timestamp desc
I want to get this result:
id lc_counter lc_timestamp
1 15 2013-03-01 11:54:43
10 7 2013-03-01 11:54:43
100 5 2013-03-01 11:54:43