代码如下:
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)
谢谢您的浏览!