select sum(a) from
(
select count(1) as a from member where company_id="UIC23338821" union all
select count(1) as a from sub_member where main_customer_id in (select customer_id from member where company_id="UIC23338821")
)c
select sum(a) from
(
select count(1) as a from member where company_id="UIC23338821" union all
select count(1) as a from sub_member where main_customer_id in (select customer_id from member where company_id="UIC23338821")
)c