/* print subscribers that haven't payd after 7 days from subscription */
SELECT id, email, firstname, lastname, importo
FROM iscrizione_iscritto 
WHERE pagato=False 
AND time < NOW() - INTERVAL '5 days';

/* print total subscribers group by fascia oraria */
SELECT SUM (COALESCE(size_adulti,0) + COALESCE(size_giovani,0) + COALESCE(size_bambini,0)) as Persone, fasce_orarie
FROM iscrizione_iscritto
GROUP BY fasce_orarie
ORDER BY NULLIF(regexp_replace(fasce_orarie, '\D', '', 'g'), '')::int;
