Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- drop table if exists #1
- CREATE TABLE #1 (ObjectId int, variant int, value int)
- INSERT INTO #1
- VALUES (1,1,null), (1,2,null), (1,1,1), (1,2,3),(1,3,3),(1,3,4)
- -------------------------------
- SELECT ObjectId, variant
- FROM #1 y
- GROUP BY y.ObjectId, y.variant
- except
- SELECT ObjectId, variant
- FROM #1 x
- WHERE value IS NULL
- GROUP BY ObjectId, variant
- -------------------------------
- SELECT ObjectId, variant
- FROM #1 y
- GROUP BY y.ObjectId, y.variant
- having max(iif(value is null, 1, 0)) = 0
Advertisement
Add Comment
Please, Sign In to add comment