create table tmp as select id as col1 from `temp_price` WHERE id = 52 group by id,marketid,date_format(date,'%Y%m%d'); delete from temp_price where id = 52 and id not in (select col1 from tmp);
drop table tmp;
該方法主要創建一個臨時表存儲select信息。這樣就避免了delete 和select的異常錯誤。sql