selecta.*,b.SumPointfromExpert_Topic_Indexa,( selectTopicID,Sum(Point)asSumPointfromexpert_reply_index wherePostUserName='ghj1976' GroupbyTopicID HavingSum(Point)0 )asb wherea.TopicID=b.TopicID 这里其实就是把一个查询的结果放到
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 对分组结果进行的查询。