SHARE
TWEET

Untitled

a guest Jun 20th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DELETE FROM MyTable
  2. WHERE ID = (SELECT ID
  3.             FROM MyTable
  4.             WHERE ...whatever ...);
  5.      
  6. WITH r AS (
  7.   SELECT ID
  8.   FROM MyTable
  9.   WHERE ...whatever...
  10. )
  11. DELETE FROM MyTable
  12. WHERE (SELECT count(*) FROM r) = 1
  13.   AND ID IN (SELECT ID FROM r)
  14. RETURNING ID;
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top