Sql Server - user CTE in subquery
问题 This question has been asked before - How we can use CTE in subquery in sql server? The only answer suggested was "Just define your CTE on top and access it in the subquery?" This works, but I would really like to be able to use a CTE in the following scenarios - as a subquery in a SELECT as a derived table in the FROM clause of a SELECT Both of these work in PostgreSQL. With Sql Server 2005, I get "Incorrect syntax near the keyword 'with'". The reason I would like it is that most of my