with alias_name1 as (subquery1), alias_name2 as (subQuery2), …… alias_nameN as (subQueryN) select col1,col2…… col3 from alias_name1,alias_name2……,alias_nameN
Oracle with语句的例子:
复制代码 代码如下:
WITH Q1 AS (SELECT 3 + 5 S FROM DUAL), Q2 AS (SELECT 3 * 5 M FROM DUAL), Q3 AS (SELECT S, M, S + M, S * M FROM Q1, Q2) SELECT * FROM Q3;