N、uo

mysql group by 的一些高级的使用方法

select * from table 基础语句

group by 只能含有一个固定量,其余项目均需要用函数算法或者组列来进行描述反馈

select group_concat(distinct name) as "使用过名字",uid,SUM(mchange) as "充值与消费平帐" from table group by uid;

group_concat 按组列表

distinct 排除重复

SUM 之和

from table 后边可以跟 判断语句 where 之类的


 
上一篇 下一篇
评论
©N、uo | Powered by LOFTER