GROUP BY MySQL query question
Posted on 2014-03-18
I have a businesses database with duplicates. When i GROUP BY BusinessName in a City always the first result in the DB will appear. Example:
ID 1 - BusinessName A (old result with old address, phone ..)
ID 2 - BusinessName A (new result with new address, phone ..)
In this case ID 1 will be shown.
Now when I import a new business database with new businesses I would like to echo ID 2 instead of ID 1 because ID 2 has updated address, phone number and so on. How can this be done without removing ID 1 from DB?
The best solution would be to replace ID 1 with ID 2. The problem is each business has a unique ID which is indexed in search engines therefore removing the old ID 1 would hurt search engine traffic.
Thanks for some input!