February 6th, 2013, 03:51 AM
Join Date: Jul 2005
Time spent in forums: 1 Day 5 h 57 m 14 sec
Reputation Power: 8
JOIN count wont show items with 0 results
I've been playing around with this query to get a count of then number of times a particular tag occurs in a relational table.
I have 2 tables
Here is the I've come up with
SELECT * FROM (SELECT T.tag, COUNT(C.tag_id) AS num FROM tags T JOIN comment_tags C ON T.id = C.tag_id GROUP BY T.tag) AS A WHERE A.tag LIKE '%tag%' LIMIT 10
I get the following
What I'm trying to get it
Am I trying to do this the wrong way?
Any help would be appreciated.