当前位置: 代码迷 >> PB >> 购置总金额大于100的用户的个数
  详细解决方案

购置总金额大于100的用户的个数

热度:50   发布时间:2016-04-29 07:14:06.0
购买总金额大于100的用户的个数
表A
用户   订单号   购买金额    其他  
user     1         10       ...
user     2         10       ...
user1    3         20       ...
user2    4         30       ...

请问我要查询 购买总金额大于100的用户的个数的mysql语句怎么写呀?可以用一个语句写出来吗?各位帮帮忙呀??
------解决方案--------------------
select count(1) from  A  
group by 用户
having sum(购买金额)>100
------解决方案--------------------
select count(1) from 表A group by 用户 having sum(购买金额) > 100
------解决方案--------------------
select count(用户) from a 
group by 用户
having  sum(购买金额) >100
  相关解决方案