加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

一个SQL语句获得某人参与的帖子及在该帖得分总和

发布时间:2020-12-12 09:39:25 所属栏目:MsSql教程 来源:网络整理
导读:selecta.*,b.SumPointfromExpert_Topic_Indexa,( selectTopicID,Sum(Point)asSumPointfromexpert_reply_index wherePostUserName='ghj1976' GroupbyTopicID HavingSum(Point)0 )asb wherea.TopicID=b.TopicID 这里其实就是把一个查询的结果放到新的一个查询

selecta.*,b.SumPointfromExpert_Topic_Indexa,(
selectTopicID,Sum(Point)asSumPointfromexpert_reply_index
wherePostUserName='ghj1976'
GroupbyTopicID
HavingSum(Point)>0
)asb
wherea.TopicID=b.TopicID 这里其实就是把一个查询的结果放到新的一个查询中了。 另外Having对分组结果进行的查询。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读