1. 程式人生 > >查詢資料庫重複的值及去重複操作

查詢資料庫重複的值及去重複操作

Mysql查詢某欄位值重複的資料

select user_name,count(*) as count from user group by user_name having count>1;

去重複

creat table temp as select max(id) as id,a1,a2 from a group by a1,a2