购买总金额大于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