I'm sure this will equate down to the use of the COUNT statement but I'm not very good at SQL.
Here are my SQL Tables.
Teams Table:
TeamId TeamName RosterSpots
-----------------------------------------------
1 Miami Heat 12
2 New York Knicks 10
Players Table:
PlayerId PlayerName TeamId
------------------------------------
1 Dwyane Wade 1
2 Chris Bosh 1
3 LeBron James 1
4 Amar'e Stoudemire 2
What is the SQL (Miscroft SQL Server 2008) that will return the number of Players on each team?
output
Team Name PlayerCount
-----------------------------
Miami Heat 3
New York Knicks 1
I'd also like to return the RosterSpots and Team Id but really just the COUNT part above is what I'm puzzled with.