ORACLE SQL: 查詢表中重復(fù)數(shù)據(jù)
Posted on 2007-09-05 14:34 匪客 閱讀(1088) 評(píng)論(0) 編輯 收藏 所屬分類: 數(shù)據(jù)庫
查詢數(shù)據(jù)
?? ?查詢姓名相同的用戶的數(shù)量和姓名:
??? Select count(*) ,username from userinfo
??? Group By?username
??? Having count(*) >1???
??? 查詢結(jié)果如下:
??? COUNT(*)?USERNAME
??? 4??????????????????許明
??? 2????????????????? 劉起龍
??? 17??????????????? 王海濤
刪除相同數(shù)據(jù)
??? Delete from userinfo Group By?username Having count(*) > 1