Skip to content
Advertisement

Multiple CTE where clauses referece CTW column

For example

Can I direct doing this instead of joining of UserDetail inside my second CTE.

I am getting error of:

multi-part of identifier “UserDetail.UserId” could not be found

In the CTE reference, is it possible to reference back to previous CTE without joining the CTE table? Or I am writing a wrong query

Advertisement

Answer

You can use like this – with joining the UserDetail cte

OR you can use subquery

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