I need to retrieve the latest rows with a unique value from my mysql table. Simple table layout is timestamp (now()) and a username column. The table gets new data a couple of times a second, and i need the latest row where username is unique.
SELECT MAX(timestamp) as timestamp, username
FROM bla
WHERE timestamp < (now() - interval 30 minute)
GROUP BY username
ORDER BY timestamp DESC
It seems that this query does not return the latest values, probably because the group is doing something i dont want...