I am using the following query to select duplicate phone numbers from a table.
SELECT id, REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( phone, "+", '' ) , ")", '' ) , "(", '' ) , "-", '' ) , ' ', '' ) AS strippedPhone
FROM `customers`
GROUP BY strippedPhone
HAVING count( strippedPhone ) >1
LIMIT 0 , 300
It looks ugly and does not consider the possibilities of alphanumeric character on the field having the phone number.
Any better ways?