I have a table called tblEmployee. I would like sum the value and grouped by UserId.
tblEmployee:
+--------+----------+-------+
| UserId | UserName | Value |
+--------+----------+-------+
| 1 | A | 100 |
| 1 | B | 200 |
| 1 | C | 300 |
| 2 | D | 100 |
| 3 | E | 200 |
| 3 | F | 300 |
+--------+----------+-------+
I would like sum the value based on userid and shows like below output.
Output:
+--------+----------+-------+---------+
| UserId | UserName | Value | Result |
+--------+----------+-------+---------+
| 1 | A | 100 | |
| 1 | B | 200 | 600 |
| 1 | C | 300 | |
| 2 | D | 100 | 100 |
| 3 | E | 200 | |
| 3 | F | 300 | 500 |
+--------+----------+-------+---------+
How to do it?