SQL to add a summary row to MySQL result set

前端 未结 4 1513
感动是毒
感动是毒 2021-01-24 21:18

If I have a MySQL table such as:

I want to use SQL to calculate the sum of the PositiveResult column and also the NegativeResult colu

4条回答
  •  忘了有多久
    2021-01-24 21:31

    select keyword,sum(positiveResults)+sum(NegativeResults)
    from mytable
    group by
    Keyword
    

    if you need the absolute value put sum(abs(NegativeResults)

提交回复
热议问题