我有一个加入
SELECT * FROM Y
INNER JOIN X ON ISNULL(X.QID, 0) = ISNULL(y.QID, 0)
Isnull
像这样的 Join 使它变慢.这就像有条件加入.有没有办法解决这样的问题?我有很多记录,其中 QID
为 Null
Isnull
in a Join like this makes it slow. It's like having a conditional Join.
Is there any work around to something like this?
I have a lot of records where QID
is Null
任何人都有一个不需要修改数据的解决方法
Anyone have a work around that doesn't entail modifying the data
你有两个选择
INNER JOIN x
ON x.qid = y.qid OR (x.qid IS NULL AND y.qid IS NULL)
或者更简单
INNER JOIN x
ON x.qid IS NOT DISTINCT FROM y.qid
这篇关于空值上的 SQL 内部联接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!