I have a MySQL database containing names and addresses, but there are some duplicate names with only partial addresses such as
Name | Address
========================
Smith | 10 Main St., Cincinnati, OH 45202
Smith | 10 Main St.
I need a SQL query to select all rows with a duplicate name and the shorter of the two LIKE addresses. I was able to use GROUP BY and COUNT() for exact duplicates, but I don’t know of a way to apply that to substrings like the example above. Any ideas? Thanks.
Something like this should work: