with PACKLIST(PLANNAME,COLLID) as
(
SELECT 'PLAN_1','COL001' UNION ALL
SELECT 'PLAN_1','COL200' UNION ALL
SELECT 'PLAN_2','COL200' UNION ALL
SELECT 'PLAN_3','COL001'
)
SELECT P.PLANNAME,P.COLLID
FROM PACKLIST AS P
WHERE P.COLLID='COL001' AND NOT EXISTS
(
SELECT 1 FROM PACKLIST AS X
WHERE X.PLANNAME=P.PLANNAME
AND X.COLLID='COL200'
)
1条答案
按热度按时间wfveoks01#
如果适合您的话,您可以试试上面的吗