当前位置:Gxlcms > 数据库问题 > SQL 公用表达式CTE

SQL 公用表达式CTE

时间:2021-07-01 10:21:17 帮助过:2人阅读

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

SQL 公用表达式CTE

标签:

人气教程排行