我有一個擁有近400,000條記錄的MySQL表。在Mysql中查找重複的型號
我想列出所有的Model_Number
這是重複
我試着用以下2查詢和MySQL只是不斷加載和hangs.`AZ_Code」是SKU
查詢應返回所有記錄沒有一個記錄
select p1.AZ_Code from dumpdata as p1
join dumpdata as p2 on
(p1.`AZ_Code` != p2.`AZ_Code`)
group by p1.Model_Number
查詢2
SELECT AZ_Code, Model_Number
FROM dumpdata
WHERE Model_Number IN (
SELECT Model_Number
FROM Dumpdata
GROUP BY Model_number
HAVING COUNT(id) > 1
)
你的第二個查詢應該工作重複的型號。只需將Dumpdata更改爲dumpdata(或反向perhabs) – Mojtaba