delete from 加上 select 的处理方式
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的异常错误。
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的异常错误。下一篇:
Redis缓存穿透,雪崩,击穿问题