sql sum函数计算过的数据.能作为条件吗
有多个用户,每个用户有多个积分,用SQL语句显示每个用户的积分总和Selectd.userid,sum(d.interal)FromdetailsdGroupByd.us...
有多个用户,每个用户有多个积分,用SQL语句显示每个用户的积分总和
Select d.userid,sum(d.interal)
From details d
Group By d.userid,d.interal
语句上可以加条件只显示某一积分总和是多少的用户吗
可以这样写吗
Select d.userid,sum(d.interal)
From details d
where sum(d.interal) = '2000'
Group By d.userid,d.interal 展开
Select d.userid,sum(d.interal)
From details d
Group By d.userid,d.interal
语句上可以加条件只显示某一积分总和是多少的用户吗
可以这样写吗
Select d.userid,sum(d.interal)
From details d
where sum(d.interal) = '2000'
Group By d.userid,d.interal 展开
展开全部
Select d.userid,sum(d.interal)
From details d
Group By d.userid,d.interal
having sum(d.interal) =10
From details d
Group By d.userid,d.interal
having sum(d.interal) =10
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Select d.userid,sum(d.interal) as suminteral
From details d
Group By d.userid,d.interal
having suminteral =10
From details d
Group By d.userid,d.interal
having suminteral =10
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Select * From (
Select d.userid,sum(d.interal) AS SUMM
From details d
Group By d.userid,d.interal
) TBL
Where SUMM>xxx
Select d.userid,sum(d.interal) AS SUMM
From details d
Group By d.userid,d.interal
) TBL
Where SUMM>xxx
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用having关键字可以作为条件,因为是聚合函数吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
答:不能
聚合函数不能用做条件
聚合函数不能用做条件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |