Skip to content
Advertisement

Cognos SQL WITH clause generating syntax error

I have an SQL query I’m running in Cognos 11 and am trying to use a WITH clause but keep getting an error for incorrect syntax near “WITH”. I thought my org admins had disabled WITH but I have confirmed with them that it’s enabled and I cannot figure out what is wrong with my syntax. I’ve tried this in both Native SQL as well as Pass-through SQL.

I have this wrapped in a CASE that is otherwise working fine:

Pretty straight forward and I am more convinced there’s something wrong with my org’s implementation of Cognos than I am that the SQL is faulty. Hoping for some help from this community.

Advertisement

Answer

You can’t put a common table expression inside a query. Even if I correct your CTE:

…it still won’t work.

But this might work:

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