首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

购买总金额大于100的用户的个数,该如何解决

2012-03-15 
购买总金额大于100的用户的个数表A用户订单号购买金额其他user110...user210...user1320...user2430...请

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

热点排行