Nok Posted April 6, 2021 Share Posted April 6, 2021 Hello, my question is regarding the code below. I usually see double left joins which refer to the table1 for both LEFT JOINS (FROM cities/cities as tabl1), this one is referring to countries.code as table1 in the second LEFT JOIN which confuses me somewhat. Is the first or second LEFT JOIN excecuted first? Basically I'm asking which has priority and which table gets LEFT JOINed first. SELECT cities.name AS city, urbanarea_pop, countries.name AS country, indep_year, languages.name AS language, percent FROM cities LEFT JOIN countries ON cities.country_code = countries.code LEFT JOIN languages ON countries.code = languages.code ORDER BY city, language; SELECT cities.name AS city, urbanarea_pop, countries.name AS country, indep_year, languages.name AS language, percent from languages right join countries on languages.code = countries.code right join cities on countries.code = cities.country_code order by city, language; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now