Skip to content
Advertisement

A correct query produces a syntax error when used as a sub-query

First, I have this query, which works just fine:

But then, I use it as a sub-query:

And get this error:

  1. How do I fix this and achieve the intended result?
  2. How, in general, can a correct query become an incorrect sub-query?

Advertisement

Answer

Use a CTE:

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