Zkuste toto: SELECT source_id, (SUM(clicked)+SUM(viewed)) AS Total FROM your_table GROUP BY source_id