SQL中With关键字的简单用法
2011-02-25 03:18 音乐让我说 阅读(1060) 评论(0) 编辑 收藏 举报代码如下:
select * from dbo.HRReOrPuType /* with 的写法避免了产生临时表的IO,更多建议请参考:http://wudataoge.blog.163.com/blog/static/80073886200961652022389/ */ with t_rePuType1 as ( select Id from HRReOrPuType where typeName like '出勤奖%' )/* 后面可以接N个,但with结束后,必须使用with定义的这些变量 , t_rePuType2 as ( ) */ select * from dbo.HRUserReAndPu where hRReOrPuTypeId in (select * from t_rePuType1)
谢谢您的浏览!
作者:音乐让我说(音乐让我说 - 博客园)
出处:http://music.cnblogs.com/
文章版权归本人所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。