I need show duplicates mobile in database.
i have base like: id_client, name, surname, adress, mobile, email etc. etc....
and i try query:
SELECT mobile, COUNT(mobile)
FROM clients
GROUP BY mobile
HAVING COUNT(mobile)>1;
Its shows me duplicate mobiles and how many (count) its double.
I need last column to list duplicate id_clients like:
ect:
mobile, count(mobile), list_id_duplicate_clients
+48510509490 | 7 | 135,124,821,212,532,234,
+48555555555 | 15 | 11, 14
(...)
How i can make last (three) column? plx help
edit: Ok i have code:
select
nip,
GROUP_CONCAT(id_client ORDER BY nip SEPARATOR ', ') as double_nip
FROM clients
GROUP BY nip having COUNT(*) > 1
its make me NIP duplicate
and
select
mobile,
GROUP_CONCAT(id_client ORDER BY mobile SEPARATOR ', ') as double_mobile
FROM clients
GROUP BY mobile having COUNT(*) > 1
Its make me MOBILE duplicate
But how i can compare NIP and MOBILE and show:
mobile, nip_duplicate, mobile_duplicate
+48510509490 | 135,124,821 | 111,155,12
+48555555555 | 11, 14 | 121, 241
sb can help?