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 对分组结果进行的查询。