mysql - Reference 2 rows on same column/table, from a different table -


I'm working on the State Tracking webpage for Virtual Hockey League on Xbox I have my basic table layout setup, but How am I struggling with the query that will allow me to show the schedule. Below is my basic table layout, and what I would like to do, looks like this:

Game 1:
New York v Chicago - Detroit vs. Boston

Game 2:
Boston vs. New York - Chicago vs. Detroit

  Select homeTeam.name AS HOME_TEAMNAME Game Game Schedule Shade Inner Join GameStats GameStat Homes On Red.ID = GameStatholm. GameSchedule_ID and Sched.homeTeam_ID = GameStatsHome .team_ID Posted on Inner Join Team Team Home. Team.ID = GameStathmom.Tom_ID   

I know how I am crossing this problem is trying to pull the team. The name for both GameSchedule.awayTeam_ID and GameSchedule.homeTeam_ID but I did not understand how to do it. I think I'm very close..but then, I do not know what I'm doing, and have spent about 3 days to get this question out. I think someone can tell me in the right direction, I should be good for the rest of the need ... any help would be greatly appreciated.

  Table: Team ---- --------------------------------- ----------------- ----- | ID | Name | Short name | Conference | Partition | -------------------------------------------------- --------- | 1 | New York | TMA | 1 | 1 | | 2 | Chicago | TMB | 1 | 1 | | 3 | Detroit | TMC 1 | 1 | | 4 | Boston | TMD | 1 | 1 | -------------------------------------------------- --------- Table: GameSaadule -------------------------------------- ---------- | ID | AwayTeam_ID | | HomeTeam_ID | GameTime_ID | ------------------------------------------------ | 1 | 1 | 2 | 1 | | 2 | 3 | 4 | 1 | | 3 | 4 | 1 | 2 | | 4 | 2 | 3 | 2 | ------------------------------------------------ Table: GameStats ------------------------------------------ | ID | GameSchedule_ID | | Team_ID | | Goals | ------------------------------------------ | 1 | 1 | 1 | 5 | | 2 | 1 | 2 | 3 | | 3 | 2 | 3 | 6 | | 4 | 2 | 4 | 1 | | 5 | 3 | 1 | 2 | | 6 | 3 | 4 | 5 | ------------------------------------------    

This will give you both names

 . Name as far away, home. Name as the name HomeTeam Game_Schedule gs JOIN Team T.Id = G.Avitam_ID Team Home at TID = G.Homment_ID   

Which you want to join in He can do it!

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -