จากรูปไม่ทราบว่าเป็นที่อะรัยครับ เกิดจากโค๊ตรายงาน หรืออย่างอื่น ขอคำแนะนำด้วยครับ
hos v.3.58.1.23
select a.*
,if(fbs1 between 70 and 130
and fbs2 between 70 and 130,"X"," ") "OK"
from (select pt.hn,concat(pt.pname," ",pt.fname," ",pt.lname) as name,v.age_y,address(pt.hn) address,cm.clinic
,cast(getwordnum(group_concat(fbs order by s.vn desc),1) as decimal) fbs1
,cast(getwordnum(group_concat(fbs order by s.vn desc),2) as decimal) fbs2
,group_concat(ce2be(s.vstdate) order by s.vn desc) date
from (select hn,group_concat(clinic order by clinic) clinic
from clinicmember
where clinic in (001,002)
group by hn) cm
left join patient pt on cm.hn=pt.hn
left join opdscreen s on pt.hn=s.hn
left join thaiaddress t on t.chwpart=pt.chwpart and t.amppart=pt.amppart
left join vn_stat v on v.hn=cm.hn
where s.vstdate between "2015-01-01" and "2015-03-31"
and s.bps>0
and cm.clinic="001" and pt.chwpart="15" and pt.amppart="06"
group by hn order by pt.chwpart,pt.amppart,pt.tmbpart,cast(pt.moopart as signed)) a
where fbs1 between 70 and 130
and fbs2 between 70 and 130