SELECT SUM(a.suma) from (SELECT (CASE WHEN sum(cantidad) > 0 THEN 1 WHEN sum(cantidad) <= 0 THEN 0 END) AS suma FROM volcado GROUP BY reserva)a