BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: MR.KRAPONG<> ที่ กันยายน 06, 2011, 16:08:54 PM

หัวข้อ: ขอดูคำสั่งให้หน่อยครับ
เริ่มหัวข้อโดย: 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
หัวข้อ: Re: ขอดูคำสั่งให้หน่อยครับ
เริ่มหัวข้อโดย: nahos ที่ กันยายน 06, 2011, 16:20:23 PM
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
หัวข้อ: Re: ขอดูคำสั่งให้หน่อยครับ
เริ่มหัวข้อโดย: pijit_w ที่ กันยายน 06, 2011, 16:21:24 PM
ลองทดสอบดู ไม่แน่ใจ

and a.spclty ='xx'
หัวข้อ: Re: ขอดูคำสั่งให้หน่อยครับ
เริ่มหัวข้อโดย: MR.KRAPONG<> ที่ กันยายน 06, 2011, 16:27:31 PM
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'  เลยไม่ได้ซักกะที