Extract data from MySQL today. After using ROLLUP statistics, add the project name to the left column of the data and use SQL
SQL code
SELECT (case when isnull (PLAYERNO) then playerno = total else playerno end) as playerno, SUM (AMOUNT) FROM penalties
GROUP BY PLAYERNO WITH ROLLUP
The result is:
This way
+ ---------- + ------------- +
| PLAYERNO | SUM (AMOUNT) |
+ ---------- + ------------- +
| 6 | 100.00 |
| 9 | 25.00 |
| 27 | 175.00 |
| 44| 130.00 |
| 104/50.00 |
| NULL | 480.00 |
+ ---------- + ------------- +
6 rows in set, 1 warning (0.00 sec)
It is displayed as a null value and is modified as follows:
SQL code
Select playerno, SUM (AMOUNT) FROM penalties
GROUP BY PLAYERNO
UNION
Select total, SUM (AMOUNT)
FROM penalties
Display result:
+ ---------- + ------------- +
| PLAYERNO | SUM (AMOUNT) |
+ ---------- + ------------- +
| 6 | 100.00 |
| 9 | 25.00 |
| 27 | 175.00 |
| 44| 130.00 |
| 104/50.00 |
| TOTAL | 480.00 |
+ ---------- + ------------- +
6 rows in set (0.00 sec)