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

前端 未结 8 1122
情书的邮戳
情书的邮戳 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:08

    Here is query to find email's which are used for more then one login_id:

    SELECT email
    FROM table
    GROUP BY email
    HAVING count(*) > 1
    

    You'll need second (of nested) query to get list of login_id by email.

提交回复
热议问题