select order_id,product_id,count(*) from product_commit group by order_id,product_id having count(*)>1
create table bak_product_comment_181119 as select * from product_comment; 或者 create table bak_product_comment_181119 like product_comment;//建立表結構 insert into bak_product_comment_181119 select * from product_comment;
delete a from product_comment a join( select order_id,product_id,min(comment_id) as comment_id from product_comment group by order_id,product_id having count(*)>=2 ) b on a.order_id=b.order_id and a.product_id=b.product_id and a.comment_id > b.comment_id