对于Ex:
MY_TABLE
COL1->'P1','P2','P3'
输出应该显示P4,P5
我试过了:
select col1 from my_table where col1 not in ('p4','p5');
答案 0 :(得分:1)
理想情况下,您应该在适当的SQL表中具有该范围的值。由于缺乏这一点,您可以使用即时CTE来保持范围:
WITH cte AS (
SELECT 'p1' AS col1 FROM dual UNION ALL
SELECT 'p2' FROM dual UNION ALL
SELECT 'p3' FROM dual UNION ALL
SELECT 'p4' FROM dual UNION ALL
SELECT 'p5' FROM dual
)
SELECT t1.col1
FROM cte t1
LEFT JOIN my_table t2
ON t1.col1 = t2.col1
WHERE t2.col1 IS NULL