Trying to get the latest and unique entry from this table below. It has several doublings, they must be filtered out.
id topic action date 1 10127 2 2015-09-24 15:28:30 2 10127 4 2015-09-24 15:29:26 3 10127 2 2015-09-24 15:30:01 4 10127 3 2015-09-24 15:30:55 5 10127 1 2015-09-24 16:07:25 6 10127 5 2015-09-24 16:10:25 7 10127 4 2015-09-24 16:29:26
Using this query (found here) is my best effort, but returns only one result.
SELECT MAX(action) as action,topic,date FROM ...... GROUP by topic ORDER by action DESC
I would like this list to be the last and unique for the "action" for the "topic":
id topic action date 3 10127 1 2015-09-24 15:30:01 4 10127 2 2015-09-24 15:30:55 5 10127 3 2015-09-24 16:07:25 6 10127 4 2015-09-24 16:10:25 7 10127 5 2015-09-24 16:29:26
Hope someone has a solution! Thanks!
source share