0

I am trying to delete the matching rows from two complex subqueries. I am using postgresql. Here is a sample code:

DELETE FROM complex_subquery1 as a
USING   complex_subquery2 as b
WHERE a.column1 = b.column2

I read here: PostgreSQL: delete rows returned by subquery that this is not really possible this way. Is there a shortcut for the case of deleting inner join?

1
  • Why don't you do it with CTE as in the linked answer ? Commented Sep 9, 2019 at 3:48

1 Answer 1

0

The normal way to do that is

DELETE FROM atable
USING complex_subquery1 as a,
      complex_subquery2 as b
WHERE a.column1 = b.column2
  AND a.column3 = atable.column4;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.