select count(ov.hn) as chn from vn_stat ov, ovst ovst, patient pt where ov.vn=ovst.vn and pt.hn=ov.hn and ov.vstdate between "2008-05-01" and "2008-07-20" and ov.age_y>= 0 and ov.age_y<= 200 and ov.vn in ('')
SELECT op.rxdate,op.rxtime,op.hn,op.an,concat(p.pname,p.fname,' ',p.lname)AS ptname,d.name AS drug_name,op.qty,op.unitprice,op.sum_price
FROM opitemrece op
LEFTOUTERJOIN s_drugitems d ON op.icode=d.icode
LEFTOUTERJOIN patient p ON op.hn=p.hn
WHERE op.vstdate BETWEEN'2008-06-01'AND'2008-06-05'
AND d.name LIKE'gentamicin%'
ORDERBY op.rxdate,op.rxtime
;D ;D ;D
หัวข้อ: Re: อยากได้รายชื่อผู้ป่วยที่มารับบริการที่ได้รับยาตามที่กำหนด เช่น gentamicin
เริ่มหัวข้อโดย: por ที่ กรกฎาคม 23, 2008, 11:36:27 AM
select o.hn,o.vn ,o.an,o.icode ,o.vstdate ,d.name from opitemrece o left outer join drugitems d on d.icode = o.icode where o.vstdate between '2008-06-01' and '2008-06-02'