工作中遇到了,不多废话,直接上码,想了解详情的有很多大佬写过,我个菜鸟只写快速用法,快速入门
--单个写法
with result as
(
select * from TableName where id>10
)
select * from result
--多个的写法加个逗号,后面的关联不能省
with result as
(
select * from TableName where id>10
)
,result2 as
(
select * from TableName where age>18
)
select * from result a,result2 b where a.id=b.id