user1611830
user1611830

Reputation: 4857

mysql query : null values behavior when left joining

The question might be very simple, but I don't understand how the null values behave in an mysql syntax. Suppose I have this prepared request :

select t1.* 
from table1 t1 
left join table2 t2 
   on t1.id = t2.id 
   and some_entry = :value 
where t2.the_id is null

some_entry is a table2 entry, t2.the_id is the incremental index of table2. What will be the output if table2 is empty ?

Upvotes: 1

Views: 441

Answers (1)

John Woo
John Woo

Reputation: 263703

What will be the output if table2 is empty?

Even if table2 is empty, it will still display all records on table1 because you have used LEFT JOIN.

Upvotes: 1

Related Questions