I have one table like below query
mysql> select *from DemoTable;
This will produce the following output −
+--------------------+
| ListOfValues |
+--------------------+
| 20, 10, 40, 50, 60 |
+--------------------+
1 row in set (0.00 sec)
Expected output is below.
+----------+
| TotalSum |
+----------+
| 180 |
+----------+
1 row in set (0.00 sec)
I tried below examples but not working any one.
SELECT SUM(replace(ListOfValues, ',', '')) as TotalSum FROM DemoTable;
Here only first value came to in output, sum is not working.
+----------+
| TotalSum |
+----------+
| 20 |
+----------+
1 row in set (0.00 sec)
Can any one help please. I was tried so many examples taken from stackoverflow but no use.