When the asns table is empty, SUM() returns NULL which cannot be scanned into an int. Wrap SUM expressions in COALESCE to return 0 instead of NULL.
When the asns table is empty, SUM() returns NULL which cannot be scanned into an int. Wrap SUM expressions in COALESCE to return 0 instead of NULL.