Find rows that have the same value on a column in MySQL

前端 未结 8 1126
情书的邮戳
情书的邮戳 2020-11-30 16:27

In a [member] table, some rows have the same value for the email column.

login_id | email
---------|---------------------
john     | john123@hot         


        
8条回答
  •  心在旅途
    2020-11-30 17:23

    First part of accepted answer does not work for MSSQL.
    This worked for me:

    select email, COUNT(*) as C from table 
    group by email having COUNT(*) >1 order by C desc
    

提交回复
热议问题