I want to find out sum of total commission in this table by worker id
show record like this
| workerid | branchid | rankid | totalcommission |
| 3 | 4 | 12 | 45. |
| 9 | 4 | 1 | 269.00 |
| workerid | branchid | rankid | totalcommission |
| 3 | 4 | 12 | 45. |
| 9 | 4 | 1 | 269.00 |
Know the answer? Post it. Somebody with the same question will find it here.
Sunny SharmaRank #223 · 11.1K reputationPosted Jun 2, 2013, 6:46 PM EDT
Use this query:
SELECT workerid, MAX(branchid), MAX(rankid), SUM(TotalCommission) FROM
Hope it helps :)
Please accept this as answer if it helps.
Thanks.
Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 2, 2013, 11:43 PM EDT
hi,
here i have some query...
you want to sum of Total Commission by Worker Id wise Or
Worker Id, RankId, BranchId wise?
Try following Query it give you a sum of Total Commission by Worker Id, RankId, BranchId wise
SELECT workerid, branchid, Rankid, SUM(TotalCommission)
FROM #tablename> GROUP BY workerid,branchid, Rankid
hope this will help you.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts