1

Right now I have the query

DELETE FROM connections
WHERE "user_b_id" IN
(SELECT "id"
FROM   "users"
WHERE  'dharness.student@gmail.com'="email")

But what I really want is

WHERE "user_b_id" OR "user_a_id" IN ...

But I can't figure out how to make that work. Is there an operator for this?

Dylan Harness
  • 719
  • 1
  • 9
  • 20

1 Answers1

3

If users.email is unique you can write

WHERE (SELECT id FROM users 
       WHERE email = 'dharness.student@gmail.com') 
   IN (user_b_id , user_a_id)
dnoeth
  • 59,503
  • 4
  • 39
  • 56