MySQL Query to Count Unique Domains from Email Address field

后端 未结 7 1834
执念已碎
执念已碎 2020-12-13 02:16

I\'d like to get a better idea of what domains my customers are using. I could easily do this in PHP by explodeing each address and counting the domain that way

7条回答
  •  Happy的楠姐
    2020-12-13 02:51

    You can use this query to get Unique count of domain from table.

    SELECT substr(email,INSTR(email,"@")+1),count(substr(email,INSTR(email,"@"))) from YOUR_TABLE group by substr(email,INSTR(email,"@"));
    

提交回复
热议问题