ITPub博客

首页 > IT职业 > IT职场 > mysql怎么实现with as

mysql怎么实现with as

IT职场 作者:yaweche 时间:2021-09-11 10:14:25 0 删除 编辑

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自学网!!

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4257/viewspace-2833213/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: python分哪些工作
请登录后发表评论 登录
全部评论

注册时间:2019-08-12

  • 博文量
    0
  • 访问量
    970