select distinct(b.id) id ,a.name name from 缺陷表 a,历史表 b
where a.id=b.id
and b.STADATE > '2005-05-01'
and b.id <> (select id from 历史表 where statename = '完成')
where a.id=b.id
and b.STADATE > '2005-05-01'
and b.id <> (select id from 历史表 where statename = '完成')
sql="select count(1) from table1 a,table2 b"
sql=sql&" where b.缺陷ID=a.ID"
sql=sql&" and b.statename ='发现'"
sql=sql&" and b.STADATE >= to_date('2005-05-01 00:00:00','yyyy-mm-dd hh24:mi:ss')"
sql=sql&" and a.FAULTID not in (select 缺陷ID from table2 where statename='完成')"运行时间很长 2分钟都不出结果
如果我把
sql=sql&" and a.FAULTID not in (select 缺陷ID from table2 where statename='完成')"
去掉后
一下子就出结果了
sql=sql&" and a.ID not in (select 缺陷ID from table2 where statename='完成')"