เมือ where ค่าน้ำตาล ด้วย between 0 and 200 ค่าออกมาตามปกติ
แต่ where ค่าน้ำตาล ด้วย between "'+fbs1+'" and "'+fbs2+'" (ที่เป็นตัวแปร)
ค่า น้ำตาลออกไม่ครบครับ code ที่เขียนไม่แน่ใจถูกหรือป่าว รบกวนหน่อยครับ ขอบคุณครับผม
'SELECT lab_head.hn,lab_head.vn, concat(patient.pname, patient.fname," ", patient.lname) as "name", vn_stat.age_y, '+
'vn_stat.vstdate, vn_stat.aid, vn_stat.moopart, lab_order.lab_order_result ,lab_order.lab_items_name_ref, '+
'lab_head.report_date ,lab_order.lab_order_number,cm.clinic,c.name,o.bw,o.bps,o.bpd,o.height,o.pulse,o.temperature ,cm.other_chronic_text '+
'FROM lab_head '+
'LEFT JOIN lab_order ON lab_head.lab_order_number = lab_order.lab_order_number '+
'LEFT JOIN vn_stat ON lab_head.hn = vn_stat.hn '+
'LEFT JOIN patient ON vn_stat.hn = patient.hn '+
'LEFT JOIN clinicmember cm ON cm.hn = vn_stat.hn '+
'LEFT JOIN clinic c ON c.clinic = cm.clinic '+
'LEFT JOIN opdscreen o ON o.vn= vn_stat.vn '+
'where order_date between "'+ds1+'" AND "'+ds2+'" '+
'and vn_stat.age_y between "'+age1+'" and "'+age2+'" '+
'and cm.clinic="001" '+
'and vn_stat.aid in ("150701","150702","150703","150704","150705") '+
'and ((lab_order.lab_items_name_ref = "Glucose from finger") or (lab_order.lab_items_name_ref = "FBS from Vein")) '+
'and lab_order.lab_order_result between "'+fbs1+'" and "'+fbs2+'" '+
'group by vn_stat.hn order by lab_order.lab_order_result '