ผมใช้คำสั่งนี้ครับ ช่วยอาจารย์ดูที่ครับว่าใช้ได้ไหม
... น่าจะเป็น ...
if gl1='OPD' then
Value := GetSQLIntegerData('select count(vn) as c_an from vn_stat'+
' where vstdate between "'+ds1+'" and "'+ds2+'"'+
' and (pdx between "F20" and "F25" or pdx between "F28" and "F29"');
if gl1='IPD' then
Value := GetSQLIntegerData('select count(an) as c_an from an_stat'+
' where regdate between "'+ds1+'" and "'+ds2+'"'+
' and (pdx between "F20" and "F25" or pdx between "F28" and "F29"');
... หรือ ...
if gl1='OPD' then
Value := GetSQLIntegerData('select count(vn) as c_an from vn_stat'+
' where vstdate between "'+ds1+'" and "'+ds2+'"'+
' and (pdx between "F20" and "F25" or pdx between "F28" and "F29"')
else
Value := GetSQLIntegerData('select count(an) as c_an from an_stat'+
' where regdate between "'+ds1+'" and "'+ds2+'"'+
' and (pdx between "F20" and "F25" or pdx between "F28" and "F29"');