sql - How do I know which table is left and right mysql -
i know first select query left table, still confused when use right , left join:
ex:
select chann.name investments inv right join channels chann on chann.id = inv.channel_id; select chann.name channels chann left join investments inv on chann.id = inv.channel_id;
they both return same result, why in first query used right , why left on second one, have foreign key something?
thanks
in example both query same, because when change right left change tables order. simple understanding this, consider follow example:
select a.* table1 left join table2 b on a.key=b.key
in case, left join means records table1, because table in left. if use right means records table 2
Comments
Post a Comment