BMS-HOSxP Community
HOSxP => Report Exchange => ข้อความที่เริ่มโดย: apatnon86 ที่ ธันวาคม 24, 2012, 13:41:34 PM
-
ผมนำ Variable มาลบกันแต่มันก็ไม่ได้ผลลัพธ์ที่ถูกต้องออกมา Variable ผมก็กำหนดเป็น Integer
โดย เอา Variable ช่อง รวมทั้งหมด เป็นตัวตั้ง
ลบด้วย Variable ช่อง จำนวนผู้รับบริการในเวลาราชการทั้งหมด
ก็จะได้ค่า จำนวนผู้รับบริการนอกเวลาราชการทั้งหมด
แต่มันไม่ยอมลบครับ ขอคำชี้แนะด้วย
-
กำหนดเป็น valiable3 =variable1.value - variable2.value หรือเปล่าครับ..
-
กำหนดแบบนี้ครับ ลองทั้ง บวก และ ลบ แล้วก็ไม่ได้ครับ
Value := variable2.value - variable1.value
-
อาจเกิดจากการเรียงลำดับเหตุการณ์ผิด
ดูจาก CalcOrder
*****
ระวังการใช้หน่วยคน หรือการใช้ distinct() ของละเหตุการณ์
อาจไม่ใช่ ผลรวมทั้งหมด
-
select 'Intime' as type
,count(if((h.holiday_date is null or o.visit_type='I'),o.hn,null)) 'case53'
,count(distinct if((h.holiday_date is null or o.visit_type='I'),o.hn,null)) 'visit53'
from ovst o
left join holiday h on h.holiday_date=o.vstdate
where o.vstdate between '2009-10-1' and '2010-9-30'
union
select 'OutTime' as type
,count(if(not (h.holiday_date is null or o.visit_type='I'),o.hn,null)) 'case53'
,count(distinct if(not (h.holiday_date is null or o.visit_type='I'),o.hn,null)) 'visit53'
from ovst o
left join holiday h on h.holiday_date=o.vstdate
where o.vstdate between '2009-10-1' and '2010-9-30'
union
select 'Total' as type
,count(o.hn) 'case53'
,count(distinct o.hn) 'visit53'
from ovst o
left join holiday h on h.holiday_date=o.vstdate
where o.vstdate between '2009-10-1' and '2010-9-30'
-
ไปกำหนดใน calculation ของ variable ให้คำสั่งจาก
GetSQLStringData เป็น GetSQLIntegerData
ครับ
-
ไปกำหนดใน calculation ของ variable ให้คำสั่งจาก
GetSQLStringData เป็น GetSQLIntegerData
ครับ
ยังไม่ได้เหมือนเดิมครับ
-
ผมแก้เฉพาะ column แรกให้เป็นตัวอย่าง ที่ต้องตรวจสอบคือ calc order ว่าจะให้คำนวณอะไรก่อน อะไรหลัง ลองไปแก้ไขต่อนะครับ