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

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

    I know this is a very old question but this is more for someone else who might have the same problem and I think this is more accurate to what was wanted.

    SELECT * FROM member WHERE email = (Select email From member Where login_id = john123@hotmail.com) 
    

    This will return all records that have john123@hotmail.com as a login_id value.

    0 讨论(0)
  • 2020-11-30 17:27
    select email from mytable group by email having count(*) >1
    
    0 讨论(0)
提交回复
热议问题