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

前端 未结 3 731
臣服心动
臣服心动 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:25

    It's not as simple as this, is it?

    SELECT SUM(SIZE)
    FROM Table
    WHERE bla = '5'
    
    0 讨论(0)
  • 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)
    
    0 讨论(0)
  • 2020-12-11 01:45
    SELECT SUM(size) AS overallSize FROM table WHERE bla = 5;
    
    0 讨论(0)
提交回复
热议问题