Guest User

Untitled

a guest
Dec 10th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. WITH cte AS ( SELECT id, type, COUNT(DISTINCT type) OVER (PARTITION BY id) cnt
  2. FROM table
  3. WHERE type IN ('A', 'B')
  4. )
  5. SELECT id, type
  6. FROM cte
  7. WHERE cnt = 2
Add Comment
Please, Sign In to add comment