mysql - Does first LEFT JOIN apply to multiple JOINs? -



mysql - Does first LEFT JOIN apply to multiple JOINs? -

i have multiple join in form of

select * column1 left bring together column2 using(id) bring together column3 using(name) bring together column4 using(info) column1.id = 44

if changing left join join; obvious reason, query homecoming nil in absence of column2.id. main info column1 , others supportive data; thus, want retrieve info if column1.id exists.

my question is: first left join guarantees query homecoming column1 values column1.id exists, regardless of subsequent joins (e.g. when column3.name not exist)? or need alter next (all) joins left join too?

you have few options direct reply question no.

change subsequent joins left joins.

select * column1 left bring together column2 using(id) left bring together column3 using(name) left bring together column4 using(info) column1.id = 44

if possible, re-arrange query...

select * column1 bring together column3 using(name) bring together column4 using(info) left bring together column2 using(id) column1.id = 44

or...

select * column1 bring together ( column3 bring together column4 using(info) left bring together column2 using(id) ) using(name) column1.id = 44

on side note, i'd avoid natural joins , using syntax. logic less transparent, it's more open bugs, more open break later (if add together field 1 of tables duplicating field in using option), etc, etc.

mysql sql join left-join

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -