SELECT sum(s.sent) AS sent
, sum(s.response) AS response
FROM (SELECT CASE WHEN type = 1 THEN 1 END AS sent
, CASE WHEN type = 4 THEN 1 END AS response
FROM table
WHERE some condition) as s;Add a code snippet to your website: www.paste.org