Thank you very much for your response. However, I'm unclear what you want me to substitute for sum(...)?
select '1' as "num_ads", sum(...)
from
(select a.userid from
user_event_stg2 a, user_region b
where a.userid = b.userid
and b.region_code = 1000
and a.messagetype = 'impression'
group by a.userid having count(a.userid) = 1)
group by num_ads;
I was able to eliminate that sub-select per your recommendation. That makes things a bit easier.
Thanks.