I have a table which looks like this
blog.group_blog
blog integer primary key
groupid integer primary key
accepted integer
dateaccepted timestamp indexed
I want to get a list of groupids which have had blogs accepted on them most recently. So, I want a list of distinct groupids ordered by dateaccepted (descending). I've tried a number of queries all have which have failed (duh, that's why I'm posting here:p)
Here are some of them
SELECT groupid FROM blog.group_blog GROUP BY groupid ORDER BY dateaccepted DESC LIMIT 100;
SELECT DISTINCT groupid FROM blog.group_blog ORDER BY datecreated DESC LIMIT 100;
SELECT DISTINCT ON (groupid) groupid, dateaccepted FROM blog.group_blog ORDER BY datecreated DESC LIMIT 100;
Anyone got any other ideas for this problem?
Cheers
Rob