读书人

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

发布时间: 2012-02-12 17:16:33 作者: rapoo

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

读书人网 >SQL Server

热点推荐