Unexpected WITH near XXX

Knowledge Drop

Last tested: Dec 1, 2020

This is one example of an error you can get by using a CTE in a derived table. See ​this post for more info.

More examples:

BigQuery:
Syntax Error: Expected \"(\" or keyword SELECT but got keyword WITH at...