有没有更好的方法来重写代码?查询需要永远执行。感谢
SELECT * from w..ts
where not si in
(
select si from g..sa
)
and ci in
(
Select ClientID from w..tcwhere ds= 'AZ'
)
and s> 2
and sd between '1/1/2010' and GETDATE()
order by si
答案 0 :(得分:1)
考虑加入或改为使用。
SELECT * from webservice..tService
left join table t1 on t1.col1 = tService.col2
inner join table t2 on t2.col1 = tService.col2
where t1.ServiceID is null
and ServiceStep > 2
and ServiceDate between '1/1/2010' and GETDATE()
order by ServiceID