Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这个问题可能很简单,但我不明白空值在 mysql 语法中的行为方式。假设我有这个准备好的请求:
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 是 table2 条目,t2.the_id 是 table2 的增量索引。如果 table2 为空,输出会是什么?
What will be the output if table2 is empty?
即使table2为空,它仍然会显示所有记录,table1因为您使用了LEFT JOIN.
table2
table1
LEFT JOIN