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

minify - Minimizing css files -

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -