Menu
I have the following table format.
ID, Player1ID, Player2ID, RingID
What I want to do is display all players and a count for how many times they’ve played in a particular ring.
On any given row the player could be player1 or player2.
I know I can filter the RingID in the where clause.
“`
SELECT DISTINCT p.playerId, COUNT(`fightId`) as Fight
FROM `fights` f
JOIN `players` p ON f.player1ID OR f.player2ID = p.playerId
WHERE `venueId` = 2
GROUP BY p.playerId