I am so totally lost.
Working on a database for my co-rec team. Players, Matches, Available players for a match, chosen players for a match, etc.....
The first major step I'd like is to be able to combine Players, Matches and Available to get a list of matches with the number of Women and number of Men available.
Here are my tables:
Players (id, Gender, Name, ....)
id Gender Name
1 M David
2 M Alberto
3 F Alison
4 F Karen
5 F Callie
6 M Stephan
Matches (id, ...)
id
1
2
3
Available (id, matchID, playerID)
id matchID PlayerID
1 1 1
2 1 8
3 1 11
... ... ...
16 2 1
17 2 2
18 2 15
... ... ...
26 3 6
27 3 7
28 3 18
Desired Result
Match Women Men Total
1 5 10 15
2 4 6 10
3 6 10 16
... ... ... ...
Here's the closest I've got (just this morning):
select m.id, p.gender
from matches m
inner join available a on m.id = a.matchid
inner join players p on p.id = a.playerid