BMS-HOSxP Community
HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: Bluebird ที่ มกราคม 19, 2016, 09:13:06 AM
-
value:=GetSQLStringData('select distinct count(hn)as chn '+
'from oapp '+
'where nextdate = "'+DBPipeline['nextdate']+'" '+
'and clinic="'+DBPipeline['clinic']+'" '+
'and oapp_id <= "'+DBPipeline['oapp_id']+'" ');
ลองทดสอบ Query เลขที่ออกอยู่ แต่พอไปใส่ใน Variable ปรากฏว่าเป็น 0
-
แบบนี้พอได้มั้ยครับ
-
คำสั่งก็ประมาณนี้ครับ
Var
a := String;
a := GetSQLStringData('select oapp_id from oapp where nextdate="'+FormatDateTime('yyyy-mm-dd',DBPipeline['nextdate'])+'" '+
' and clinic="'+DBPipeline['clinic']+'" '+
' order by oapp_id limit 1 ');
Value := GetSQLStringData('select count(oapp_id) as cc from oapp where '+
' nextdate="'+FormatDateTime('yyyy-mm-dd',DBPipeline['nextdate'])+'" '+
' and clinic="'+DBPipeline['clinic']+'" and oapp_id between "'+a+'" and "'+DBPipeline['oapp_id']+'" '+
' order by oapp_id ');
-
ขอบคุณครับ