1.
select ucity,group_concat(uid) as uids
-> from users
-> group by ucity;
2.
select ucity,group_concat(uid order by uid separator '_') as uids
-> from users
-> group by ucity;
3.with rollup:分类之后汇总
select ucity,count(*)
-> from users
-> where ucity in ('上海','长沙')
-> group by ucity
-> with rollup;
4.having:分组之后数据筛选
select ucity,count(*)
-> from users
-> group by ucity
-> having count(*) >=3;