这个SQL是帮网友优化的,很简单:
30s返回结果:
select * from B11QUA_three
where project_id='TJWQSZ'
and type='04'
and times='初检'
and suggestion='通过'
and sid not in
(select isnull(cj_sid,0) from B11QUA_three
where project_id='TJWQSZ'
and type='04'
and times='复检'
and suggestion='通过');
1s返回结果:
select * from B11QUA_three a
where project_id='TJWQSZ'
and type='04'
and times='初检'
and suggestion='通过'
and not exsit
(select 1 from B11QUA_three b
where a.sid=b.cj_sid
and project_id='TJWQSZ'
and type='04'
and times='复检'
and suggestion='通过')