Here is sample query
SELECT
name,
sum(SELECT id FROM mytable WHERE cond='1' and cond2='2') as mysum1,
sum(SELECT id FROM mytable WHERE cond3='3' and cond4='4') as mysql2
FROM
mytable
WHERE
userid='1' and status='1';
Obviously this does not work but I think you can now understand what I mean. How to retrieve records in this manner.