In the sql below I have the last 5 posts. But sometimes these posts are from the same author. I want to select the last 5 but just one per author.
SELECT `e` . * ,
`f`.`title` AS `feedTitle` ,
`f`.`url` AS `feedUrl` ,
`a`.`id` AS `authorId` ,
`a`.`name` AS `authorName` ,
`a`.`about` AS `authorAbout`
FROM `feed_entries` AS `e`
INNER JOIN `feeds` AS `f` ON e.feed_id = f.id
INNER JOIN `entries_categories` AS `ec` ON ec.entry_id = e.id
INNER JOIN `categories` AS `c` ON ec.category_id = c.id
INNER JOIN `authors` AS `a` ON e.author_id = a.id
GROUP BY `e`.`id`
ORDER BY `e`.`date` DESC
LIMIT 5
EDITED
I've ended up with it:
SELECT a.id, e.date, e.title, a.name
FROM feed_entries e, authors a
WHERE e.author_id =a.id
ORDER BY e.date DESC
LIMIT 5
In this query, how can I get just one post for each author?