[mysql] MySql sum elements of a column

I have a table with 3 columns (A,B,C). I want to select some rows from the table and then the MySQL to return a single row having the values added on each column...

   A B C
1. 2 2 2
2. 4 4 4
3. 6 7 8

MySql should return in this case, if I select all the three rows:

   A   B  C
1. 12  13 14

This question is related to mysql sum

The answer is


 select sum(A),sum(B),sum(C) from mytable where id in (1,2,3);

Try this:

select sum(a), sum(b), sum(c)
from your_table

select
  sum(a) as atotal,
  sum(b) as btotal,
  sum(c) as ctotal
from
  yourtable t
where
  t.id in (1, 2, 3)