Incorrect syntax near the keyword 'WITH' when try to "Explore results"

MS SQL Server

"With" statement is working perfectly when just using and displaying SQL questions on dashboards for example.

Not working
"Exploring results" on a SQL question with a "With" statement results in the following error:
Incorrect syntax near the keyword 'WITH'

Does anybody know why this is happening and|or know how to fix it?

Hi @v4Jt
It's a limitation of SQL Server. The only fix is to not use CTEs for nested queries: - upvote by clicking :+1: on the first post

1 Like