当前位置: 代码迷 >> Sql Server >> 一条查询语句,该怎么处理
  详细解决方案

一条查询语句,该怎么处理

热度:79   发布时间:2016-04-27 21:15:09.0
一条查询语句
语名如下:
select   top   300   *   from   kq_source   where   tt> = '1 '     and   tt <= '100 '    
and     empid   in   (select   id   from   zlemployee   where   Dept= 'zx '     and   state <> '9 ')
执行速度在1分钟左右~如IN后面直接用值却很快。
请高手帮我优化!

------解决方案--------------------
select top 300 * from kq_source ,
((select id from zlemployee where Dept= 'zx ' and state <> '9 ')) t
where tt> = '1 ' and tt <= '100 ' and kq_source.empid = t.id
  相关解决方案