sql查詢一張表的重複資料

執筆記憶的空白發表於2015-08-05

近日由於同事操作失誤,在新增資料的時候,新增了重複資料..   遂需要sql查出是哪條資料,以下萬能的模板命令


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


其實就是找到一個唯一的或者你想要查的資料, 然後分組統計下就行了


下面是我需要查資料的sql命令

select menu_id,COUNT(*) as count from t_menu_l where menu_id in (select menu_id from t_menu) and lang_id=1 GROUP BY menu_id having count>1;

相關文章