I have a table for pages with fields slug
(string, not unique) and updated
(datetime). I want to retrieve a list of last updated pages based on the updated
field, but I only want one result for every slug
(since slugs can be re-used across pages in this case). What to do?
I tried this:
SELECT * FROM `pages`
GROUP BY `slug`
ORDER BY `updated` DESC
That gives only one result per slug, but not always the last updated one.