Ok im not sure what it is I need. But I have a sort of fantasy baseball website that I want to add something to. I want to see what players have been on the most championship teams. I just don't know how to query the players against the results of those that have won a world series.
Here are the Tables Im working with
Season Results
id, int
team_id, int
wins, numeric
loss, numeric
year, numeric
division, int
pennant, int
world_series, int
This table will tell me the team_id of any team that has won a world series. world_series will be "1" for any team that has won a world series.
Stats_Batting
ID, int
player_id, int
team_id, int
year, numeric
Now this table has much more than this as I have each stat as well but these are the basic fields that will give us what we need most notably the the player_id, and year.
Now what I need to do is count the number of world series teams a player has played for.
I need to count the number of times that a player_id shows up with the same team_id and and year that match with a season results team_id and year where world series = 1
I hope this makes sense and I have provided enough information.