Find duplicate column value in sqlite

前端 未结 2 1704
臣服心动
臣服心动 2021-01-30 06:47

I have inserted some values in the table DataTab.

SomeId: Integer     => Autogenerated primary key.
DataId: Guid
DataNumber: Integer
DataTyp         


        
相关标签:
2条回答
  • 2021-01-30 07:12
    SELECT DataId, COUNT(*) c FROM DataTab GROUP BY DataId HAVING c > 1;
    
    0 讨论(0)
  • 2021-01-30 07:31

    I have used it in my application. It is working based on your query

    SELECT a.* 
    FROM CENTERDETAILS a 
    JOIN 
    (SELECT IPADDR, MACID, COUNT(*) 
        FROM CENTERDETAILS  
        GROUP BY IPADDR, MACID 
        HAVING count(*) > 1
    ) b ON a.IPADDR = b.IPADDR OR a.MACID = b.mac 
    ORDER BY a.MACID
    
    0 讨论(0)
提交回复
热议问题