with as 树形查询
例子:
如:table表字段
id name age
------------------------------------------------------
with result as
(
select * from table where age>20
)
update result set age=20;
--上述语句意思是 table表里面的age大于20的都改成20.
------------------------------------------------------------
with xxx as 还可以连表
如:
with rn as
(
select * from table where age>20
),sn as
(
select * from rn where id>200
)
select * from sn