155
« เมื่อ: กุมภาพันธ์ 05, 2009, 11:26:14 AM »
อยากได้รายงาน สถิติการให้บริการผู้ป่วยใน สิทธิผู้ป่วยเป็นสิทธิผู้พิการที่ขึ้นต้นด้วย ท74 นะคะ ต้องเพิ่มโค้ดตรงไหนค่ะ
set @t1 = unix_timestamp('2008-10-01');
set @t2 = unix_timestamp('2009-09-30');
select "IPD" as type, year(regdate)+543 year, case month(regdate)
when '1' then 'ม.ค.'
when '2' then 'ก.พ.'
when '3' then 'มี.ค.'
when '4' then 'เม.ย.'
when '5' then 'พ.ค.'
when '6' then 'มิ.ย.'
when '7' then 'ก.ค.'
when '8' then 'ส.ค.'
when '9' then 'ก.ย.'
when '10' then 'ต.ค.'
when '11' then 'พ.ย.'
when '12' then 'ธ.ค.'
end as month, count(distinct hn) as count_hn , count(an) as count
from an_stat
where unix_timestamp(regdate) between @t1 and @t2
group by year(regdate), month(regdate)