SQL - Add up all row-values of one column in a singletable

前端 未结 3 753
臣服心动
臣服心动 2020-12-11 01:13

I\'ve got a question regarding a SQL-select-query: The table contains several columns, one of which is an Integer-column called \"size\" - the task I\'m trying to perform is

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-11 01:42

    Are you looking for:

    SELECT SUM(Size) FROM MyTable WHERE bal = '5'
    

    You can also (in MSSQL)

    SELECT Size, COl1, COl2 FROM MyTable WHERE bla ='5' COMPUTE SUM(Size)
    

提交回复
热议问题