ผมไปเจอรูปแบบนี้มา
select tem.name, count(*)
from(select name from results
union all
select name from archive_results) as tem
group by name
order by name
แต่จะปรับเข้ากับโค้ดนี้อย่างไร
select count(distinct(hn)) as hn from ovstdiag o
where o.vstdate BETWEEN "2010-10-01" AND "2011-09-30" and icd10 BETWEEN "A070" and "A099"
union
select count(distinct(ip.hn)) as hn from iptdiag i,ipt ip
where i.an=ip.an and ip.dchdate BETWEEN "2010-10-01" AND "2011-09-30" and icd10 BETWEEN "A070" and "A099"