You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
smitpatel
changed the title
Support for common table expressions (aka WITH)
Support for common table expressions (aka WITH) using LINQ
Oct 28, 2021
smitpatel
changed the title
Support for common table expressions (aka WITH) using LINQ
Support for common table expressions (aka WITH) by translating LINQ query
Oct 28, 2021
roji
changed the title
Support for common table expressions (aka WITH) by translating LINQ query
Support for common table expressions (aka WITH) via special LINQ operator
Apr 25, 2023
Note: all databases - except SQL Server - support embedding CTEs within arbitrary subqueries inside the query;
SELECT*FROM (WITH t AS (SELECT1) SELECT*FROM t) AS foo;
This effectively makes CTEs an optional prefix of SelectExpression.
In addition, SQL Server (but not other databases) requires that column names be explicitly specified when they're not named within the subquery:
WITH t AS (SELECT1AS q) SELECT*FROM t; -- Column name bubbles out of the subquery
WITH t (q) AS (SELECT1) SELECT*FROM t; -- Column explicitly specified as part of the CTE syntax
WITH t AS (SELECT1) SELECT*FROM t; -- Fails in SQL Server, works elsewhere (with unknown column name)
We could have a special queryable-returning function which we'd translate into a TableExpressionBase:
... becomes:
Do recursive CTEs as well.
Note: CTEs are also valid with
WITH ... INSERT ... INTO
,WITH ... DELETE
,WITH ... UPDATE
.Community implementations
The text was updated successfully, but these errors were encountered: