I am trying to get a total of all the records for playerid from table1, table2 and table3 by playername.
There are 4 tables, table-1, table-2, table-3, and players.
I am not great with queries and I expect somebody here can instantly see where I am going wrong.
This is what I have:
SELECT
`table-1`.playerid AS playerid1,
COUNT(*) AS count,
`table-2`.playerid AS playerid2,
COUNT(*) AS count,
`table-3`.playerid AS playerid3,
COUNT(*) AS count,
FROM `players`
INNER JOIN `table-1`
ON `table-1`.playerid = `players`.playerid
INNER JOIN `table-2`
ON `table-2`.playerid = `players`.playerid
INNER JOIN `table-3`
ON `table-3`.playerid = `players`.playerid
WHERE `players`.playername = 'Player1'
Can anyone give me some pointers as to what I am doing wrong... Thanks.