BMS-HOSxP Community
HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: MR.KRAPONG<> ที่ กันยายน 06, 2011, 16:08:54 PM
-
ด้วยคำสั่งนี้จะสามารถดึง 10 อันดับโรคผู้ป่วยใน เฉพาะแผนก กุมารเวช ต้องเพิ่มตรงไหนครับ
select a.pdx,i.name,count(a.an) as cc
from an_stat a
left outer join icd101 i on a.pdx=i.code
left outer join patient p on a.hn=p.hn
where a.dchdate between '2011-01-01' and '2011-09-06'
and a.pdx not like 'z%'
group by a.pdx
order by count(a.an) desc
limit 10
-
select a.pdx,i.name,count(a.an) as cc
from an_stat a
left outer join icd101 i on a.pdx=i.code
left outer join patient p on a.hn=p.hn
where a.dchdate between '2011-01-01' and '2011-09-06'
and a.pdx not like 'z%' and a.spclty="05"
group by a.pdx
order by count(a.an) desc
limit 10
;D
-
ลองทดสอบดู ไม่แน่ใจ
and a.spclty ='xx'
-
select a.pdx,i.name,count(a.an) as cc
from an_stat a
left outer join icd101 i on a.pdx=i.code
left outer join patient p on a.hn=p.hn
where a.dchdate between '2011-01-01' and '2011-09-06'
and a.pdx not like 'z%' and a.spclty="05"
group by a.pdx
order by count(a.an) desc
limit 10
;D
ขอบคุณนะครับ
โอเคเลยครับ พอดีผมใส่ and a.spclty='05' เลยไม่ได้ซักกะที