I have data in the following format.
Column 1 and Value from the database. I use a LEFT() function to extract Column 2. Where I need help is to sum the values from the newly calculated Column 2 and list the sums a new column.

Any help is appreciated. Thanks.
Basically, you seem to want an aggregation with a function for the aggregation key:
select left(column1, 1), sum(value)
from t
group by left(column1, 1);
SELECT *
,CalculatedColumn2 = LEFT(Column1,1)
,Value
,CalculatedSum = SUM(Value) OVER (PARTITION BY LEFT(Column1,1))
FROM
Table
While Gordon's answer get's you the SUM if you want it per row you can use a partitioned window Function such as SUM() OVER.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With