Skip to content
Advertisement

“table or view does not exist” and “invalid identifier” errors with “with” clause

I did 3 different queries using with clause:

These queries are just meaningless test stataments so don’t bother with their function.

The 1st query had compilation error:

The 2nd query had another error:

And the 3rd query ran successfully.

But according to what I’ve learned, all of them should perform correctly as derived relations defined using with clause can be accessed anywhere in the same query. So why?

Advertisement

Answer

1 You can’t access the alias from the outer query.

instead simply use

2 This is not valid syntax

in requires a comma separated list of values like

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