Hi, I'm trying to perform a DISTINCT
clause on a query like this
SELECT DISTINCT username, wiki.text, wiki.date
FROM wiki_house
INNER JOIN wiki ON wiki_house.wiki_id = wiki.id
INNER JOIN users ON wiki.user_id = users.id
AND wiki_house.house_id = 1
AND wiki.language = 'it'
ORDER BY wiki.date DESC
LIMIT 10
this returns:
username wiki.text wiki.date
mike Hello 2010-03-09
mike Helo 2010-03-08
kim Whats... 2010-03-07
mike When in... 2010-03-06
eddy Hel 2010-03-05
I thought this query should returned the last 10 wikis from different usernames, by the DISTINCT
clause, but it simply return me the last 10 results, so if an user has wrote 2 versions of his wiki, these are showed in the page.
How can I select only the last 10 wikis from different usernames so something like this?
username wiki.text wiki.date
mike Hello 2010-03-09
kim Whats... 2010-03-07
eddy Hel 2010-03-05