vendredi 2 janvier 2015

Count multiple tables as one count


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 :D





Aucun commentaire:

Enregistrer un commentaire