首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

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

2012-02-12 
一条查询语句语名如下:selecttop300*fromkq_sourcewherett 1andtt 100andempidin(selectidfromzlemp

一条查询语句
语名如下:
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

热点排行