2012-09-10 97 views

回答

3

我不認爲你想使用exists我想你想使用in

delete from temp1 where measureid in 
    (select t1.measureid from temp1 t1, temp2 t2 where t2.measureid = t1.measureid); 

或更好,但

delete from temp1 where measureid in 
    (select measureid from temp2); 
1

這是因爲

select t1.* from temp1 t1, temp2 t2 where t2.measureid = t1.measureid 

總是返回行。你可能想要的是

delete from temp1 t1 where exists (select t2.* from temp2 t2 where t2.measureid = t1.measureid)