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 對分組結果進行的查詢。