2

I have the following query in Redshift:

delete * from a
left join s on a.order_id = s.id
where s.order_id is not null

When I try to execute it, it gives me back the warning of the title. However, it does have a where clause, so I am wondering why this appear.

Maybe it is because the where clause makes reference to the query of the join and not the other? If so, how could avoid this warning?

1
  • I removed the postgresql because no such warning exists there. Commented Nov 12, 2019 at 14:51

2 Answers 2

2

You could attempt to rewrite it, something like:

DELETE FROM a
WHERE a.order_id IN (SELECT DISTINCT id FROM other_table)
Sign up to request clarification or add additional context in comments.

Comments

1

Turns out the solution (for maintaining the join) was to delete the *.

delete from a
left join s on a.order_id = s.id
where s.order_id is not null

1 Comment

I'm trying to compose a similar delete statement in Redshift, except looking for rows that do not exist in s by using WHERE s.order_id IS NULL but I can't seem to get it to work.

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.