I want to do a query that is like the icons on the top of
http://slashdot.org. That is I want to select the 5 most recent distinct
categories from a bunch of stories. So I have...
SELECT DISTINCT category.oid, category.title, category.image FROM story,
category* WHERE story.category = category.oid AND story.approved ORDER
BY datetime DESC LIMIT 5;
The trouble is it doesn't return distinct results, but rather it returns
duplicates. Any ideas how I can do this query?
I thought there might be some sub-select solution, but I don't really
understand subselects. I thought of,
SELECT distinct * from (SELECT category.oid, category.title,
category.image FROM story, category* WHERE story.category = category.oid
AND story.approved ORDER BY datetime DESC )LIMIT 5;
But that doesn't work in any shape or form.