sql查出重複數據,刪除重複數據只留一條(小白專用)

查表中多餘重複記錄,根據單個字段(username)來判斷 select username,count() as num from tusertest group by username having COUNT()>1 刪除重複 DELETE FROM tusertest WHERE id NOT IN (SELECT MIN(id) FROM tusertest GROUP BY userna
相關文章
相關標籤/搜索