a guest Dec 10th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand