Watch this example on YouTube:
Here is my table:
I want to know what is total of bonus, salary and gambling for each user
The following query will provide me with this info:
Select CustomerName,
(Select Sum(Earnings)
From (Values (Bonus), (Salary), (Gambling)) As tblSum(Earnings))
From Table3
how to give column name
ReplyDeleteBetter Way...
ReplyDeleteSelect CustomerName, (Bonus + Salary + Gambling ) as Earnings
From Table3
Thank you!!!! Much easier
Delete