select a.admdate
,(select count(*) from ipt where regdate=a.admdate) 'admit'
,(select count(*) from ipt where dchdate=a.admdate) 'dch'
,(select count(*) from ipt where regdate<=a.admdate and (dchdate>a.admdate or dchdate is null)) 'Stay'
from (select i.regdate 'admdate'
from ipt i
where i.regdate between '2011-1-1' and '2011-1-31'
group by i.regdate) a