ลองใช้ Variable แบบนี้เป็นตัวอย่างครับ
if GetSQLStringData('select nextdate from oapp where vn="'+DBPipeline['vn']+'"')<>'' then
  Value := ''+GetSQLStringData('select o.nextdate from oapp o '+
  ' left outer join clinic c on c.clinic=o.clinic '+
  ' where vn="'+DBPipeline['vn'] +'" and c.chronic="Y"')
  +' '+GetSQLStringData('select concat("[ ",timestampdiff(day,o.vstdate,o.nextdate),"  Çѹ"," ]") as cc from oapp o '+
  'left outer join clinic c on c.clinic=o.clinic'+
  ' where vn="'+DBPipeline['vn'] +'" and c.chronic="Y" ')
  else
  Value := 'äÁèä´é¹Ñ´ËÁÒÂ';