php - Best way to get specific value in two table -
this question has answer here:
- mysql join clause 2 answers
i'm stuck on problem, let me explain. have 2 table 1 called league
have structure:
id|leaguecode|country|league 0 | b1 |germany|bundesliga 1 | i1 | italy |serie
another table called soccerseason
have structure:
id|caption |league |years 0|bundesliga|b1 |2014 1| serie | i1 |2014
now, want eet league
values league
table. in particular bundesliga , serie a. how can see in soccerseason
table each value have years, want select bundesliga year 2014
, nation germany
. because app, have selection structure:
select year: 2014 select nation: germany
i'm aspect result this: bundesliga
how can achieve this?
you need join tables using column exists in both tables. example, guessing soccerseason.league
same league.leaguecode
, in case can join tables using column, , return results follows:
select * league l left join soccerseason s on (s.league = l.leaguecode)
Comments
Post a Comment