SQL query does a join only if table is not empty -


what want achieve have table , table b both using same ids, of ids in not exist in b , such if looking specific id , have join don't out anything.

my query this

        select *         table_a         left join table_b b         on a.id = b.id         b.condition <> "x"         , a.id = "y" 

if select , id exists in both , b works, not if exists in a, how out results if row not in table b?

move table_b condition on clause left join result instead of inner join result.

select * table_a left join table_b b   on a.id = b.id  , b.condition <> "x" a.id = "y" 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -