Skip to content
Advertisement

Update with SUM in Same SQL Table

I want to update SUM in same SQL table based on project id and Channel. for Total Channel= SUM(Channel 1 + Channel 2)

I am trying with below Query, but something is wrong in this query

Advertisement

Answer

Not sure what your database is but if it is MSSQL Server then it is straight forward using CTE (Common Table Expression):

I have removed spaces from column names to make it easier.

An easier would be to sum up by project id and then insert total rows rather than updating them.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement