1
Report Exchange / ขอความกรุณา เรื่อง SQL การส่งจากจุดตรวจไป ตึกผู้ป่วยใน
« เมื่อ: ตุลาคม 28, 2020, 09:37:53 AM »
ขอความกรุณา เรื่อง SQL มาใส่ในรูปแบบ report ด้วยครับ ครับ
select i.an,i.hn, concat(p.fname," ",p.lname,",",p.pname) as PtName,
pt.name as PtType,concat(i.regdate," ",i.regtime) as AdmDate,w.name as Ward,
sp.name as PtSpec,d.name as AdmDoctor,i.prediag,ov.name as ComeFromSt,ou.name as AdmUser
from ipt i
left outer join ovstist ov on ov.ovstist = i.ivstist
left outer join patient p on p.hn = i.hn
left outer join ward w on w.ward = i.ward
left outer join doctor d on d.code = i.admdoctor
left outer join opduser ou on ou.loginname = i.staff
left outer join pttype pt on pt.pttype = i.pttype
left outer join spclty sp on sp.spclty = i.spclty
left outer join an_stat an on an.an = i.an
where i.regdate between "2020-10-26" and "2020-10-26"
select i.an,i.hn, concat(p.fname," ",p.lname,",",p.pname) as PtName,
pt.name as PtType,concat(i.regdate," ",i.regtime) as AdmDate,w.name as Ward,
sp.name as PtSpec,d.name as AdmDoctor,i.prediag,ov.name as ComeFromSt,ou.name as AdmUser
from ipt i
left outer join ovstist ov on ov.ovstist = i.ivstist
left outer join patient p on p.hn = i.hn
left outer join ward w on w.ward = i.ward
left outer join doctor d on d.code = i.admdoctor
left outer join opduser ou on ou.loginname = i.staff
left outer join pttype pt on pt.pttype = i.pttype
left outer join spclty sp on sp.spclty = i.spclty
left outer join an_stat an on an.an = i.an
where i.regdate between "2020-10-26" and "2020-10-26"