Nested CTE in Teradata

Common table expressions(CTE) can be used in Teradata for recursive queries.

Syntax:

WITH CTE_name(column list) AS
(
SELECT column list FROM table [(WHERE condition)]
)
SELECT * FROM CTE_name;


Note:
The column list must match between CTE and SELECT statement.
Nested CTE is not available in Teradata since multiple WITH clauses are not allowed in Teradata.