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
WITH T ( Company_Name, Company_ID, Amount )
AS
(
SELECT 'Company 6', '10024', 120 UNION ALL
SELECT 'Company 6', '10024', 569 UNION ALL
SELECT 'Company 6', '10024', 53 UNION ALL
SELECT 'Company 6', '10024', 100 UNION ALL
SELECT 'Company 6', '10024', 564 UNION ALL
SELECT 'Company 7', '10638', 9500 UNION ALL
SELECT 'Company 7', '10638', 105 UNION ALL
SELECT 'Company 7', '10638', 624
)
SELECT DISTINCT Company_Name, Company_ID,
SUM(Amount) OVER (PARTITION BY Company_ID) AS total_amount
FROM T;