How to Sum multiple lines in sql

后端 未结 8 1767
猫巷女王i
猫巷女王i 2020-12-11 12:16

I have multiple lines of data all sharing the same Company id.

Is there a way to \'sum\' all the amounts to give me one line of data per company id using SQL Server

相关标签:
8条回答
  • 2020-12-11 12:45
    SELECT Company_Name, Company_ID, SUM(Amount) 
    FROM TableName GROUP BY Company_Name, Company_ID
    
    0 讨论(0)
  • 2020-12-11 12:52
    SELECT Company_Name, Company_ID, sum(Amount)
    FROM table
    group by Company_Name, Company_ID
    
    0 讨论(0)
提交回复
热议问题