2016-01-22 70 views
0

在Postgres sql中,是否可以連續使用WITH語句?例如連續WITH子句

WITH t1 AS (
    ...some select statement 
) 

WITH t2 AS (
    ...select from t1 
) 

SELECT * FROM t2; 

我已經嘗試了上述,它似乎是工作?

回答

3

使用:

WITH t1 AS (
    ...some select statement 
), 

t2 AS (
    ...select from t1 
) 

SELECT FROM t2;