首页 > IT职业 > IT职场 > 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自学网!!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4257/viewspace-2833213/ ,如需转载,请注明出处,否则将追究法律责任。