SQL – Combining Multiple Tables to Create a Roster
In this example, I am combining the data from three tables.Two of the tables have different columns and no relation or join.
I am managing a soccer team.I have a list of weeks in the soccer season.And I also have a list of players.In addition, I also have a list of weeks in which each player have confirmed. DECLARE@WeeksTABLE
Using Transact SQL, I want to create a roster that combines all of the players and all of the weeks and specifies whether a player has confirmed participation for that week.
— declare result table
To combine all Players and all Weeks, you simply perform a select without a join.
— combine all weeks and all players to create roster
Once you have your roster, you can perform a quick update to add whether the player has confirmed for each of the weeks.