showing sum in last row of table using mysql

aggregate-functions, mysql, select, sql

Solution

I don't know why you want that but give this a try:

SELECT Col1, Col2 FROM tableName
UNION
SELECT 'SUM' as Col1, SUM(Col2) Col2 FROM tableName

Problem

I have the following Table elements how do i run a query that reproduce the table but hav an extra row at the bottom showing the sum of col2 ``` Col1 | col2 --------------- Water | 22 water | 3 water | 5 Air | 10 Earth | 3 Air | 5 ```

Original source