con questa query ottieni il numero di campi diversi da 0:
"SELECT COUNT(quantità) AS totale FROM tabella WHERE quantità != 0";