一 基本用法
with mywith as(select * from Student ) select * from mywith
二 递归调用
with mywith as( select ID,UserID,UserName,Age,CreateUser,CreateTime from Student where ID=‘D8A9D11A-4F95-414A-BE55-DA460A621954‘ union all select a.* from student a join mywith b on a.CreateTime<a.CreateTime ) select * from mywith
参考博客http://www.cnblogs.com/smailxiaobai/archive/2012/01/16/2323291.html
时间: 2024-10-13 05:35:41