SQL duplicates with different primary keys

前端 未结 7 1335
青春惊慌失措
青春惊慌失措 2021-01-24 19:56

I have a table in this form:

id | firstname | lastname
---+-----------+----------
1  | alex      | marti
2  | mark      | finger
3  | alex      | marti
4  | ted          


        
相关标签:
7条回答
  • 2021-01-24 20:50
    select id, firstname, lastname
    from table t
    where exists (select 1
    from table t2
    where t2.firstname = t.firstname
    and t2.lastname = t.lastname
    and t2.id <> t.id)
    
    0 讨论(0)
提交回复
热议问题