Link to home
Start Free TrialLog in
Avatar of Jeff Carlson
Jeff Carlson

asked on

Nested WITH clauses in DB2 sql

WITH SFPMS2 AS (
WITH SFPMS AS (Select ....

I am getting red Xs and no explanation.  Can you now do thius in DB2?
ASKER CERTIFIED SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yep, you only need "with" once, after that each cte is separated by a comma.
This is as specified in the SQL Standards by the way, not specific to DB2

no points please
Avatar of Jeff Carlson
Jeff Carlson

ASKER

Awesome thank you.  Having trouble getting it to work in DB2 so got around it by just using code and not creating calculated values.
If you'll post the code, I'm sure we can show you how to write it as a CTE.