Count NULL as 0?

coalesce(device_id,0) converts NULL to 0