เขียนแบบนี้ไหมครับ
a:= GetSQLIntegerData('select sum(d.tcount)*3 as t from dtmain d '+
' where d.vstdate between "'+ds1+'" and "'+ds2+'" and '+
' d.doctor in ('+i+') and d.doctor in ('+doctor+') and '+
' d.tmcode in ("000136") and '+
' (d.ttcode like "%UPPER%" or d.ttcode like "%LOWWER%") ');
b:= GetSQLIntegerData('select sum(d.tcount) as t from dtmain d '+
' where d.vstdate between "'+ds1+'" and "'+ds2+'" and '+
' d.doctor in ('+i+') and d.doctor in ('+doctor+') and '+
' d.tmcode in ("000136") ');
if a=0 then a:=b;
error Incompatible types ครับ