网络编程
位置:首页>> 网络编程>> 数据库>> 一个SQL语句获得某人参与的帖子及在该帖得分总和

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

  发布时间:2024-01-27 07:17:53 

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

select a.*,b.SumPoint from Expert_Topic_Index a,(
select TopicID, Sum(Point) as SumPoint from expert_reply_index
where PostUserName = 'ghj1976'
Group by TopicID
Having Sum(Point) > 0
) as b
where a.TopicID = b.TopicID

这里其实就是把一个查询的结果放到新的一个查询中了。

另外 Having 对分组结果进行的查询。

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com