BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: niwat ที่ พฤษภาคม 12, 2008, 20:59:33 PM

หัวข้อ: ช่วยแก้รายงานหน่อยครับ รายงานวัตุออกฤทธิ์ครับ
เริ่มหัวข้อโดย: niwat ที่ พฤษภาคม 12, 2008, 20:59:33 PM
select b.hn,concat(pname,fname,' ',lname) as ptname,b.vstdate,b.icode,concat(a.name,' ',strength) as drugname,b.qty,a.units
from opitemrece b
left outer join drugitems a on a.icode=b.icode
left outer join patient c on b.hn=c.hn
where  vstdate='2008-05-06'and'2008-05-06'
and (b.icode ='1000315'
or b.icode ='1000311'
or b.icode ='1000039'
or b.icode ='1500070'
or b.icode ='1000427'
or b.icode ='1000622'
or b.icode ='1000659'
or b.icode ='1000515'
or b.icode ='1000516'
or b.icode ='1000529'
or b.icode ='1000312'
or b.icode ='1000744'
or b.icode ='1000745'
or b.icode ='1000746'
or b.icode ='1000182')
order by icode

วันที่มันรันได้วันเดียวครับ   และร่วมรัหสนาด้วยครับ ผมว่ามันไม่น่ายาวแบบนี้ครับ
หัวข้อ: Re: ช่วยแก้รายงานหน่อยครับ รายงานวัตุออกฤทธิ์ครับ
เริ่มหัวข้อโดย: doramon ที่ พฤษภาคม 12, 2008, 21:37:01 PM
select b.hn,concat(pname,fname,' ',lname) as ptname,b.vstdate,b.icode,concat(a.name,' ',strength) as drugname,b.qty,a.units
from opitemrece b
left outer join drugitems a on a.icode=b.icode
left outer join patient c on b.hn=c.hn
where  vstdate='2008-05-06'and'2008-05-06'
and b.icode  in ('1000315','1000311','1000039','1500070','1000427','1000622','1000659','1000515'
,'1000516','1000529','1000312','1000744','1000745','1000746','1000182')
order by icode

ทดสอบดูครับว่าเร็วขึ้นหรือเปล่าครับ
หัวข้อ: Re: ช่วยแก้รายงานหน่อยครับ รายงานวัตุออกฤทธิ์ครับ
เริ่มหัวข้อโดย: niwat ที่ พฤษภาคม 13, 2008, 03:31:32 AM
ยังมีปัญหาเรื่องวันที่ครับ where vstdate='2008-05-06'and'2008-05-06'มันจะรันได้วันที่ 6เดือน5ปี2008 วันเดียว  พอเราแก้วันที่เป็น where vstdate='2008-05-01'and'2008-05-06'มันจะรันได้วันที่ 1เดือน5ปี 2008 วันเดียวอยู่ดี มันผิดตรงไหนครับช่วยดูอีกรอบหน่อยครับ
หัวข้อ: Re: ช่วยแก้รายงานหน่อยครับ รายงานวัตุออกฤทธิ์ครับ
เริ่มหัวข้อโดย: niwat ที่ พฤษภาคม 13, 2008, 03:44:30 AM
select b.hn,concat(pname,fname,' ',lname) as ptname,b.vstdate,b.icode,concat(a.name,' ',strength) as drugname,b.qty,a.units
from opitemrece b
left outer join drugitems a on a.icode=b.icode
left outer join patient c on b.hn=c.hn
where  vstdate between '2008-05-02'and'2008-05-06'
and b.icode  in ('1000315','1000311','1000039','1500070','1000427','1000622','1000659','1000515'
,'1000516','1000529','1000312','1000744','1000745','1000746','1000182')
order by icode ,vstdate

ได้แล้วครับ
หัวข้อ: Re: ช่วยแก้รายงานหน่อยครับ รายงานวัตุออกฤทธิ์ครับ
เริ่มหัวข้อโดย: thannawe ที่ พฤษภาคม 13, 2008, 09:18:47 AM
เริ่มเก่งแล้วครับ  ;D