I have two tables: swipe
and eclipse_hastag
:
Here is the table eclipse_hastag
:
I want to know what are the hashtag_id
that have more than state=3,6,9
I get what I want with a COUNT
but I do not know how to write next to the results the hastag_id
:
SELECT COUNT (swipe.state) FROM swipe
INNER JOIN eclipse_hashtag ON eclipse_hashtag.eclipse_id = swipe.eclipse_id
WHERE swipe.state= 3 OR swipe.state = 6 or swipe.state=9
GROUP BY eclipse_hashtag.hashtag_id
ORDER BY COUNT(swipe.state) DESC;