22,300
社区成员




-- 删除重复,保留priceID最小的一条记录
delete from history
where priceid in(
select t.priceid from (
select a.priceid from history a
where exists(select * from history where merchantId = a.merchantId and commodityId = a.commodityId and price = a.price and DATE_FORMAT(priceTime,'%Y-%m-%d') = DATE_FORMAT(a.priceTime,'%Y-%m-%d') and priceid < a.priceid)
) t
)
delete from history where (merchantId,commodityId,price,priceTime) not in (SELECT DISTINCT merchantId,commodityId,price, DATE_FORMAT(priceTime,'%Y-%m-%d') FROM supnuevo_buyer_price_history)
delete from history where (merchantId,commodityId,price,priceTime) not in (SELECT DISTINCT merchantId,commodityId,price, DATE_FORMAT(priceTime,'%Y-%m-%d') FROM supnuevo_buyer_price_history)