Skip to content
Advertisement

Why I cannot bundle two sql commands with a ”with” statement in Postgresql?

Does with statement work with multiple sql commands? I have to delete entries in 2 tables. My sql is like this:

This is not working.Out of 2 delete statement if you comment out one, then the other one works. But together they do not even compile.Definitely I can write 2 sql scripts each with 1 delete – but I want to do this in one go. I get this error:

Advertisement

Answer

You can do like below:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement