SQL “Join” on null values

前端 未结 14 1324
旧巷少年郎
旧巷少年郎 2020-12-13 14:04

For reasons beyond my control, I need to join two tables and I need null values to match. The best option I could think of was to spit out a UUID and use that as my comparis

14条回答
  •  隐瞒了意图╮
    2020-12-13 15:03

    You can't do any better, but the JOIN you have will not do an actual "JOIN" in any way (there won't be any correlation between T1.SOMECOL and T2.SOMECOL other than they both have a NULL value for that column). Basically that means that you won't be able to use a JOIN on NULLs to see if rows match.

    NULL is never equal to another NULL. How can something of unknown value be equal to something else of unknown value?

提交回复
热议问题