select count(*) from
(
SELECT field1
FROM tablename 
GROUP BY field1 
HAVING (SUM(field2) <> 0) OR (SUM(field3) <> 0) OR (SUM(field4) <> 0)
) a