比如:delete from table1 where col001 in
(select * from table2 where left(col001,7)
in (select col001 from table3 )))table3里面有10万条记录,table2里面有100万条记录,table1里面也有100万条记录。这样删除是不是会出现查找不完全的现象阿?
-------------------没试过,,,
delete t1 from table1 t1
where exists(select 1 from table3 t3 where col001=left(t1.col001,7))
and exists(select 1 from table2 where col001=t1.col001)
(select * from table2 where left(col001,7)
in (select col001 from table3 )))table3里面有10万条记录,table2里面有100万条记录,table1里面也有100万条记录。这样删除是不是会出现查找不完全的现象阿?
-------------------没试过,,,
delete t1 from table1 t1
where exists(select 1 from table3 t3 where col001=left(t1.col001,7))
and exists(select 1 from table2 where col001=t1.col001)
(select * from table2 where left(col001,7)
in (select col001 from table3 )))
---------------------------
我分析你寫的這個語句,有誤的delete from table1 where col001 in (select * from table2 where left(col001,7))在這個一句中,難道table2就 一個字段嗎???
col001 in (這裡應是和col001有一樣屬性值的集合)