BMS-HOSxP Community
HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: SV_Phichit ที่ สิงหาคม 19, 2010, 13:05:39 PM
-
รบกวนอาจารย์ท่านใดก็ได้ครับแทรกที่อยู่จาก Code นี้ให้ด้วยครับ ขอบคุณมากครับ
select v.hn, concat(p.pname,p.fname,' ',p.lname) as ptname, count(v.vn)
from vn_stat v, patient p
where v.hn=p.hn
and v.vstdate between '2009-10-01' and '2010-08-13'
group by v.hn
order by count(v.vn) desc
limit 900
-
select v.hn, concat(p.pname,p.fname,' ',p.lname) as ptname,
concat(p.addrpart," หมู่ ",p.moopart," ต.",t3.name," อ.",t2.name," จ.",t1.name) as fulladdressname,
count(v.vn)
from vn_stat v
left outer join patient p on p.hn=v.hn
left outer join thaiaddress t1 on t1.chwpart=p.chwpart
and t1.amppart="00" and t1.tmbpart="00"
left outer join thaiaddress t2 on t2.chwpart=p.chwpart
and t2.amppart=p.amppart and t2.tmbpart="00"
left outer join thaiaddress t3 on t3.chwpart=p.chwpart
and t3.amppart=p.amppart and t3.tmbpart=p.tmbpart
where v.vstdate between '2009-10-01' and '2010-08-13'
group by v.hn
order by count(v.vn) desc
limit 900
( ระวัง Server แฮงค์น่ะ )
-
รบกวนอาจารย์ท่านใดก็ได้ครับแทรกที่อยู่จาก Code นี้ให้ด้วยครับ ขอบคุณมากครับ
select v.hn, concat(p.pname,p.fname,' ',p.lname) as ptname, count(v.vn)
from vn_stat v, patient p
where v.hn=p.hn
and v.vstdate between '2009-10-01' and '2010-08-13'
group by v.hn
order by count(v.vn) desc
limit 900
ไปใช้ function GetPatientAddress ที่ อ.mn ทำไว้ในตัว report designer ดีกว่าครับ โดยอ้างอิงจาก HN ของผู้ป่วย
ลองดูจากตัวอย่างนี้นะครับ
-
ขอบคุณมากครับ :)