📜  按电子邮件域分组 mysql 代码示例

📅  最后修改于: 2022-03-11 15:05:10.560000             🧑  作者: Mango

代码示例1
SELECT substring_index(email, '@', -1) domain, COUNT(*) email_count
FROM table
GROUP BY substring_index(email, '@', -1)

-- If you want to sort as well:
ORDER BY email_count DESC, domain;