Reputation: 71
I'm dealing with the problem of working with a dirty customer database. There are many duplicates due to different spellings and maintenance quality of the data. For example the data looks like this:
My goal is to merge rows generically based on the name, so the empty columns are automatically filled with the value contained in another row:
Is there a way in SQL to do something like that?
Upvotes: 0
Views: 341
Reputation: 6638
SELECT Name,
MAX(Address) Address,
MAX(Zip) Zip,
MAX(Mail) Mail,
MAX(Phone) Phone,
MAX(City) City
FROM customer
GROUP BY Name
Upvotes: 1