是否可以在select语句中创建临时表。
所以说我想在ACCOUNT_NO列中包含值(1,2,3,4,5)的数据集。
SELECT ACCOUNT_NO FROM (1,2,3,4,5)
WHERE ACCOUNT_NO NOT IN (SELECT ACCOUNT_NO FROM OTHER_TABLE)
答案 0 :(得分:0)
您想要CTE吗?
WITH a as (
SELECT a.*
FROM ((SELECT 1 as ACCOUNT_NO) UNION ALL
(SELECT 2 as ACCOUNT_NO) UNION ALL
(SELECT 3 as ACCOUNT_NO) UNION ALL
(SELECT 4 as ACCOUNT_NO) UNION ALL
(SELECT 5 as ACCOUNT_NO)
) a
)
SELECT a.ACCOUNT_NO
FROM a
WHERE a.ACCOUNT_NO NOT IN (SELECT ot.ACCOUNT_NO FROM OTHER_TABLE ot)