2
我正在尋找重複的數據庫 - 但也顯示所有重複的記錄。我當前的查詢:MySQL查找並顯示所有重複記錄
SELECT 'duplicate' as dup,c.Id, c.CreatedDate, c.email, c.Lead_Grade__c, count(c.email)
FROM contact as c
Inner Join (select c.Id, c.email FROM contact as c group by c.email having count(c.email) > 1) as dup
ON c.email = dup.email
WHERE Lead_Grade__c is null;
這可以爲每個重複記錄提供1行。我需要2(或更多)行爲每個重複的記錄。所以,如果記錄X和記錄Y都具有相同的電子郵件,那麼我想同時顯示兩者。
有什麼想法?
謝謝!
你想如何顯示兩者?作爲單獨的行或在同一行?如果有多個? – xQbert 2015-01-15 18:25:53