SELECT id,
MIN(amount) AS minumum,
MAX(amount) AS maximum
FROM your_table
GROUP BY id HAVING minimum = 0.0
AND maximum = 0.0
a simple sum would not work in my opinion, since you could have the quantity -1 and one of 1, with the sum of 0.
Since you did not write, if you can have negative values, you must also check the minimum level.
Addition for the new restriction:
SELECT id,
MIN(amount) AS min_value,
MAX(amount) AS max_value,
MAX(account) AS max_account
FROM your_table
GROUP BY id
HAVING min_value = 0.0
AND max_value = 0.0
AND max_account IS null
source
share