I have a tagging system implemented in PHP and MySQL, with the following tables:
Table: blog_tags
- tag_id
- tag_name
Table: blog_tags_assoc
- tag_assoc_id
- article_id
- tag_id
Table: blog_articles
- article_id
- article_title
- article_content
I have them all linked using the Many to Many relationship
(reference to something similar: How to store tags in MySQL tags, one field in total or one filed for each tag?)
What I’m trying to do now is make a MySQL query that selects all the tags from blog_tags that have actually been referenced by the articles in blog_articles.
So far, I know that “HAVING” is something I might use…but I’m not sure how?
Any ideas or suggestions would be most welcome. Thanks!
This will get a tag name as well as a count of articles that tag has been used.