ตกลง ตัวแปร string กับ ตัวแปร Double มันเปรียบเทียบกันได้หรือครับ
ตกลงผมทำแบบนี้ครับ(ลืมเรื่องทศนิยมไปก่อน)
SELECT lh.hn,concat(p.pname,p.fname," ",p.lname) as pname,lg.lab_items_group_name,l1.lab_items_name,
lo.lab_order_result,l1.range_check_min,l1.range_check_max,
CONVERT(REPLACE(trim(lo.lab_order_result),',',''),UNSIGNED integer) as num1,
o.name as reportname,concat(lh.report_date," ",lh.report_time) as reporttime
from lab_head lh
left outer join lab_order lo on lo.lab_order_number=lh.lab_order_number
left outer join lab_items l1 on l1.lab_items_code=lo.lab_items_code
left outer join lab_items_group lg on lg.lab_items_group_code=l1.lab_items_group
left outer join patient p on p.hn=lh.hn
left outer join opduser o on o.loginname=lh.reporter_name
where lh.report_date between "2012-02-01" and "2012-02-02" and lo.lab_order_result<>"" and
((CONVERT(REPLACE(trim(lo.lab_order_result),',',''),UNSIGNED integer))
not between l1.range_check_min and l1.range_check_max)
order by lh.report_date