Reputation: 2549
I have the following SQL query.
SELECT p.`id`, p.`data`, p.`title`, p.`creation_date`, t.`name` AS 'tag'
FROM `post_tag` pt, `post` p, `tag` t
WHERE p.`id` = pt.`post`
AND pt.`tag` = t.`id`
AND p.`author` <> '1'
AND (t.`name` = 'Programming'
OR t.`name` = 'Photography'
OR t.`name` = '[...]')
ORDER BY p.`creation_date`, t.`name` DESC
And my resulting table looks like this:
As I've highlighted in the screenshot, rows with ID 76 and 77 are repeated. In my application's case, that is a measure of "popularity". I want to be able to:
Upvotes: 1
Views: 706
Reputation: 51904
... group by p.data order by count(*) desc, p.creation_date, t.name desc
Upvotes: 1