有如下数据
+----+---------------+
| id | email |
+----+---------------+
| 1 | |
| 2 | |
| 3 | |
| 4 | |
+----+---------------+
按域名统计email的个数
+---------+----------+
| domain | count(*) |
+---------+----------+
| 126.com | 2 |
| qq.com | 2 |
+---------+----------+
select substr(email,locate("@",email)+1) as domain,count(*) from test2 group by domain
阅读(695) | 评论(0) | 转发(0) |