intoxicated_curveball
asked on
Get all permutations of baseball players on a Team in SQL
Let's say I have 9 Tables: Catchers, Pitchers, Shortstops, First baseman, Second baseman, Third baseman, Left fielders, Right fielders, Centre fielders
Let's say each of these tables has 5 different 'Players' in it.
Now I want to get all possible team combinations (comprised of one of each position) into another table called 'Teams'
From my understanding of permutations there are 1,953,125 possible teams (5^9).
Any idea how could I create this 'Teams' table in SQL (I'm using MS Access by the way), there should be a column for each position?
Let's say each of these tables has 5 different 'Players' in it.
Now I want to get all possible team combinations (comprised of one of each position) into another table called 'Teams'
From my understanding of permutations there are 1,953,125 possible teams (5^9).
Any idea how could I create this 'Teams' table in SQL (I'm using MS Access by the way), there should be a column for each position?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Problem is, you are going to have players who play more than one position,so you are going to have to exclude all of those combinations as well.
Create a new query.
Add all the tables to it.
Select the player from each table.