select S.content
      , SUM(C.clickTimes) as total 
from subVote S left join clickCount C ON C.subID=S.id where S.ParentID=7"
group by S.content

解决方案 »

  1.   

    select s.content,(select sum(clicktimes) from clickcount where subid=s.id) as total
    from subvote s where s.parentid=7
      

  2.   

    select S.content, C.clickTimes, SUM(C.clickTimes) as total from subVote S left join clickCount C ON C.subID=S.id where S.ParentID=7"
    group by s.content
      

  3.   

    select S.content, C.clickTimes, SUM(C.clickTimes) as total from subVote S left join clickCount C ON C.subID=S.id where S.ParentID=7 group by S.content,C.clickTimes