You cannot directly do this in MySQL, because there is no function for urlencode or urldecode .
You will need to create a user-defined function to handle this process. Once you have this feature, just go to a simple group by with a having .
Link to required UDFs
If UDFs are not an option, the only workaround I can think of is to manually replace characters (at your own risk):
SELECT REPLACE(email, "%40", "@") DuplicateEmail, COUNT(*) Amount FROM t GROUP BY DuplicateEmail ORDER BY Amount desc
Fiddle is here .
Output:
| DUPLICATEEMAIL | AMOUNT | --------------------------- | abc@gmail.com | 2 | | abcd@gmail.com | 2 | | xyz@gmail.com | 1 |
source share