Remove duplicate value when we use rollup How to remove duplicate value when we use rollup in mysql?

I have a table like     

+------+--------+----------+------------+
| id | open_bal | closing_bal | balance |
+------+--------+----------+------------+
| 1 |      5005.00 |3005.00 | 8005.00   |
| 2 |      5004.00 |3004.00 | 8004.00   |
| 3 |      5003.00 |3003.00 | 8003.00   |
| 4 |      5002.00 |3002.00 | 8002.00   |
| 5 |      5001.00 |3001.00 | 8001.00   |
| 6 |      500.00  | 300.00 | 800.00    |
+------+--------+----------+|-----------+


and I got result like this 

+------+--------+----------+------------+
| id | open_bal | closing_bal | balance |
+------+--------+----------+------------+
| 6 |      500.00  |300.00  | 800.00    |
| 6 |      500.00  |NULL    | 800.00    |
| 5 |      5001.00 |3001.00 | 8001.00   |
| 5 |      5001.00 |NULL    | 8001.00   |
| 4 |      5002.00 |3002.00 | 8002.00   |
| 4 |      5002.00 |NULL    | 8002.00   |
| 3 |      5003.00 |3003.00 | 8003.00   |
| 3 |      5003.00 |NULL    | 8003.00   |
| 2 |      5004.00 |3004.00 | 8004.00   |
| 2 |      5004.00 |NULL    | 8004.00   |
| 1 |      5005.00 |3005.00 | 8005.00   |
| 1 |      5005.00 | NULL   | 8005.00   |
| 1 |      NULL    | NULL   | 15315.00  |
+------+--------+----------+|-----------+


And my desired result is like this 

+------+--------+----------+------------+
| id | open_bal | closing_bal | balance |
+------+--------+----------+------------+
| 1 |      5005.00 |3005.00 | 8005.00   |
| 2 |      5004.00 |3004.00 | 8004.00   |
| 3 |      5003.00 |3003.00 | 8003.00   |
| 4 |      5002.00 |3002.00 | 8002.00   |
| 5 |      5001.00 |3001.00 | 8001.00   |
| 6 |      500.00  | 300.00 | 800.00    |
|   |              |        |15315.00   |
+------+--------+----------+|-----------+ 


Table structure is as following:

CREATE TABLE `billing_account` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `goid` varchar(10) NOT NULL,
 `open_bal` decimal(10,2) NOT NULL,
 `balance` decimal(10,2) NOT NULL,
 `closing_bal` decimal(10,2) NOT NULL,
 `modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8


The Query that I wrote:

SELECT   open_bal, balance, SUM(closing_bal)
FROM     `billing_account`
GROUP BY open_bal, balance
WITH ROLLUP
You can use a UNION:




SELECT open_bal, closing_bal, balance
FROM `billing_account`
UNION
SELECT NULL, NULL, sum(closing_bal)
FROM `billing_account`



open_bal | closing_bal |  balance
-------: | ----------: | -------:
 5005.00 |     3005.00 |  8005.00
 5004.00 |     3004.00 |  8004.00
 5003.00 |     3003.00 |  8003.00
 5002.00 |     3002.00 |  8002.00
 5001.00 |     3001.00 |  8001.00
  500.00 |      300.00 |   800.00
    null |        null | 15315.00



dbfiddle here