I have a 3 part problem thats been giving me trouble I know how to get the tables to work if I query 1 table
at a time but I can't seem to figure out how I can combine both the tags and more_tags tables to get the same results.
The 3 main problems I have are Listed below.
PROBLEM 1
I want to be able to group the same tag from both the tags and more_tags tables.
PROBLEM 2
I also want to be able to display the tags from each table that are not present in the other table.
PROBLEM 3
I also want to count the total amount of times the tag appears in both tags and more_tags tables.
MYSQL Tables
SELECT `tags`.`tag_id`, `tags`.`tag_name`, COUNT(`tags`.`tag_name`) as 'num'
FROM `tags`
INNER JOIN `users` ON `tags`.`user_id` = `users`.`user_id`
WHERE `users`.`active` IS NULL
GROUP BY `tags`.`tag_name`
ORDER BY `tags`.`tag_name` ASC";
SELECT `more_tags`.`tag_id`, `more_tags`.`tag_name`, COUNT(`more_tags`.`tag_name`) as 'num'
FROM `more_tags`
INNER JOIN `users` ON `more_tags`.`user_id` = `users`.`user_id`
WHERE `users`.`active` IS NULL
GROUP BY `more_tags`.`tag_name`
ORDER BY `more_tags`.`tag_name` ASC";
Desired output
tag_id tag_name num
10 apple 12
192 pear 1
197 bored 1
203 sad 3
207 ads 2
217 news 1
190 bf 1
196 cape 1