架构:
CREATE TABLE #exclGeoKeys (xKEY INT);
INSERT INTO #exclGeoKeys
values
(1),
(2);
CREATE TABLE #y (NAME CHAR(1),xKEY INT);
INSERT INTO #y
values
('A',1),
('C',2),
('D',NULL),
('E',3),
('F',4);
我可以缩短以下内容以产生相同的结果并且不需要该部分OR xKEY IS NULL
吗?
SELECT *
FROM #y
WHERE xKEY NOT IN
(
SELECT *
FROM #exclGeoKeys
)
OR
xKEY IS NULL;