BMS-HOSxP Community
HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: bbbas ที่ พฤศจิกายน 18, 2013, 15:21:35 PM
-
อยากได้รายงานรายชื่อผู้ป่วยคลีนิคความดัน ที่แสดงผล BP ย้อนหลัง 3 ครั้งครับ :) :) :)
-
select c.hn,pt.pname,pt.fname,pt.lname,max(s.vstdate) lastdate
,substring_index(group_concat(cast(bps as decimal) order by vn desc),',',3) bps
,substring_index(group_concat(cast(bpd as decimal) order by vn desc),',',3) bpd
from opdscreen s
left join clinicmember c on s.hn=c.hn
left join patient pt on c.hn=pt.hn
where c.clinic=002
and s.vstdate between '2012-10-1' and '2013-9-30'
and s.bps>0
group by c.hn
-
select c.hn,pt.pname,pt.fname,pt.lname,max(s.vstdate) lastdate
,substring_index(group_concat(cast(bps as decimal) order by vn desc),',',3) bps
,substring_index(group_concat(cast(bpd as decimal) order by vn desc),',',3) bpd
from opdscreen s
left join clinicmember c on s.hn=c.hn
left join patient pt on c.hn=pt.hn
where c.clinic=002
and s.vstdate between '2012-10-1' and '2013-9-30'
and s.bps>0
group by c.hn
ถ้าผมอยากได้ 3 คร้ังต่อเนื่องละครับ อาจารย์ ต้องกรองโค้ดอย่างไรครับ เช่น ตัวอย่างข้างบนนั้น มีผลคัดกรอง ครบทั้งสามครั้ง 1 หรือ 2 คร้ัง ไม่เอามาแสดงนะครับ ต้องปรับโค้ดอย่างไรดีครับ
-
ลองดูจากกระทู้นี้นะครับเผื่อได้ไอเดีย
http://hosxp.net/smf2/index.php?topic=29034.0