Joining Three Tables in MySQL database -


i want join 3 tables. first table (result) has got result of games , contains date, team a, team b , final score. second table (line up) has detail of line i.e list of players played team on given date i.e. date, team, player1, player2, player3 etc. third table (players) contain information each player i.e name, height, weight date of birth etc. want take out information 3 tables using join. want final value date, team, player1, player1_height, player1_weight, player2, player2_height, player2_weight,and on. structure of 3 tables under please :

  • result table, date varchar(50), team varchar(50), team_score int(11)

  • lineup table, date varchar(50), team varchar(50), player1 varchar(50),
    player2 varchar(50), player3 varchar(50), player4 varchar(50), player5 varchar(50)

  • player table, firstname varchar(50), height int(11), weight int(11),birthdate varchar(256),

i joining first 2 tables date, team, player1,player2, etc using following query .

  select           result.date,           result.team,           result.team_score,           lineup.player1,           lineup.player2,           lineup.player3,           lineup.player4,           lineup.player5                    result    join          lineup    on               result.date = lineup.date; 

what can join result third table height , weight of each player in 1 row?

if understand, keep joining same table each player

select  result.date, result.team, result.team_score       , lineup.player1, p1.weight       , lineup.player2, p2.weight       , lineup.player3, p3.weight       , lineup.player4, p4.weight       , lineup.player5, p5.weight result, players p1, players p2, players p3, players p4, players p5, lineup  result.date = lineup.date , p1.playerid = lineup.playe1 , p2.playerid = lineup.playe2 , p3.playerid = lineup.playe3 , p4.playerid = lineup.playe4 , p5.playerid = lineup.playe5; 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -