i have two tables in mySQL:
Table 1: Club(ClubID=PK, club_name)
Table 2: League_table(tableID=PK, position, clubID=fk, games_played, points)
how would i join the two tables to give a query that displayed only
(position, club-name, games_played)
i have two tables in mySQL:
Table 1: Club(ClubID=PK, club_name)
Table 2: League_table(tableID=PK, position, clubID=fk, games_played, points)
how would i join the two tables to give a query that displayed only
(position, club-name, games_played)
select a.club_name, b.position, b.games_played from club as a join league_table as b on a.clubid=b.clubid Thats what you want.
@Alexen: No need of left join in this case.
@Diegoe: one friendly advise, always use on in join, without it query goes slow down when you are working on big tables.