mysql怎么实现with as

mysql怎么实现with as,第1张

mysql怎么实现with as

mysql实现with as的方法:

使用“with cr as(子查询)主查询”语句就可以查询sql片段了

示例如下:

with 
cr as (     select CountryRegionCode from person.CountryRegion where Name like 'C%' )
select * from person.StateProvince where CountryRegionCode in (select * from cr)

其中cr是一个公用表表达式,该表达式在使用上与表变量类似,只是SQL Server 2005在处理公用表表达式的方式上有所不同

更多Python知识,请关注:Python自学网!!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/3015984.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-09-28
下一篇 2022-09-28

发表评论

登录后才能评论

评论列表(0条)

保存