WITH (common_table_expression)
Valid in: SQL, ESQL, DBProc, OpenAPI, ODBC, JDBC, .NET
A Common Table Expression (CTE) is a temporary named result set, derived from a simple query and defined within the execution scope of a SELECT or INSERT statement. It is like a derived table or inline view.
CTEs can appear in the following contexts:
• SELECT
• CREATE TABLE…AS SELECT
• DECLARE GLOBAL TEMPORARY TABLE…AS SELECT
• INSERT INTO…SELECT
• CREATE VIEW
Last modified date: 04/26/2024