I have seen how to do multiple counts for different tables, but never how to combine them all into one. I have a MySQL DB where I am running the following query:
SELECT characters.name, COUNT(*) AS wiki_unlocks
FROM wiki_items
INNER JOIN characters
ON characters.character_id=wiki_items.character_id
GROUP BY wiki_items.character_id
ORDER BY wiki_unlocks DESC
LIMIT 10;
This is giving me the following which is great:
name wiki_unlocks
player1 2
player2 1
I want to get a combined count of all of the 'wiki_xxxx' tables. For example I want 'wiki_items'(above) + 'wiki_armors' + 'wiki_weapons' + …
Thanks for any help 😀
Best Answer
If performance can be a problem, because tables have lots of rows, I would do this way. Grouping and counting first and joining tables next.