question

postonoh avatar image
postonoh asked

sum totals

I am trying to some on number between dates sum (column1) as totalcolumn1 sum (column2) as totalcolumn2 sum (column3) as totalcolumn3 sum (column1 + column2 + column3) as totalall where date between given duplicate
sql-server-2008tsqlaggregates
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

That's nice. Do you have a question?
4 Likes 4 ·
what do you mean by "date between given duplicate" ?
0 Likes 0 ·

1 Answer

· Write an Answer
Fatherjack avatar image
Fatherjack answered
Start working from something like SELECT Sum(ColA) as ColA_Sum, Sum(ColB) as ColB_Sum, Sum(ColC) as ColC_Sum, Sum(ColA) + Sum(ColB) + Sum(ColC) as Tot_Sum_ColA_ColB_ColC FROM YourTable WHERE your_criteria_are_True
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@Fatherjack gotta remove the column aliases from the total sum
1 Like 1 ·
doh - copy - paste - error !
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.