mysql数据去重

create table tmp as select min(id) as col1 from test group by name,phone;
delete from test  where id not in (select col1 from tmp);
drop table tmp;



select id,receiver,mobile,address from emall_trade where status='trade_finish' and amount>='500'
and id in (select min(id) from emall_trade where status='trade_finish' and amount>='500' group by mobile)

你可能感兴趣的:(mysql)