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

前端 未结 8 1110
情书的邮戳
情书的邮戳 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条回答
  •  萌比男神i
    2020-11-30 17:12

    Thanks guys :-) I used the below because I only cared about those two columns and not so much about the rest. Worked great

      select email, login_id from table
        group by email, login_id
        having COUNT(email) > 1
    

提交回复
热议问题