Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
My database output looks as follows :
---------------------------------------------------------------
Client | TotalMonth1 | totalMonth2 | TotalMonth3 | TotalCurrent
---------------------------------------------------------------
Paul | R 2012.02 | R 2021.03 | R 205411.99 | R 12004.52 |


Now I want to add a column on the select statement that adds the totals of the month for TotalMonth1, totalMonth2, TotalMonth3.

so something like
SQL
SELECT SUM(TotalMonth1 + totalMonth2 +  TotalMonth3) as TotalLastMonths 

any suggestions?
Posted

1 solution

SQL
select Client,TotalMonth1, totalMonth2 , TotalMonth3,totalcurrent, SUM(TotalMonth1 + totalMonth2 +  TotalMonth3) as TotalLastMonths from table1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900