I have the following demo
table
cid uid unixdate
110 90 129
109 85 128
108 81 127
107 90 126
106 85 125
105 70 124
I want to create an sql select to get only 1 row for each uid
which would look like this
cid uid unixdate
110 90 129
109 85 128
108 81 127
105 70 124
But the result should be the LATEST entries (sort with unixdate
DESC)
Have tried all from this example which looks very similar like for example.these queries
SELECT * FROM demo GROUP BY uid ORDER BY unixdate DESC
SELECT * From demo GROUP BY uid HAVING COUNT(*) >=1 order by unixdate DESC
but they don't get the latest but the first entry for each UID (instead of the latest)
NOTE running mysql Server version: 5.7.21-0ubuntu0.16.04.1 - (Ubuntu) and doing the sql queries using phpmyadmin interface