อ.ขวดคับ code ตามที่ให้มา แปลงนิดหน่อย แต่ว่าออกมาอย่างที่แนบไฟล์เลยคับ ไม่ทราบว่าทำไม แต่ว่าพอเอาไป query ใน sql command ก็ปกติคับ ทำอะไรผิดหรือเปล่าคับ
ChangeDBPipeLineLink1SQL('select pq.doctor, '+
'count(distinct pq1.vn) as total_OPD,count(distinct pq2.vn) as total_ER, '+
'count(distinct pq3.vn) as total_LR,count(distinct pq4.vn) as total_SS, '+
'count(distinct op.vn) as total_OPER,count(distinct pq.vn) as total_OPD_All, '+
'count(distinct o.vn) as total_ER2 '+
'from pq_doctor pq '+
'left outer join doctor d on d.code=pq.doctor '+
'left outer join ovst o on o.vn = pq.vn '+
'left outer join operation_list op on op.vn=pq.vn '+
'and op.request_doctor=pq.doctor and pq.doctor_date=op.request_operation_date '+
'left outer join pq_doctor pq1 on pq1.vn = pq.vn '+
'and pq1.doctor = pq.doctor and pq1.depcode in (001,002,003,004,005,006,007,008,022,032) '+
'left outer join pq_doctor pq2 on pq2.vn = pq.vn '+
'and pq2.doctor = pq.doctor and pq2.depcode = 011 '+
'left outer join pq_doctor pq3 on pq3.vn = pq.vn '+
'and pq3.doctor = pq.doctor and pq3.depcode = 014 '+
'left outer join pq_doctor pq4 on pq4.vn = pq.vn '+
'and pq4.doctor = pq.doctor and pq4.depcode = 023 '+
'where pq.doctor_date between "'+ds1+'" and "'+ds2+'" '+
'and pq.depcode in (001,002,003,004,005,006,007,008,022,032,011,014,021) '+
'and o.visit_type = "I" and d.position_id = "1" and code<>"145" group by pq.doctor ');
ChangeDBPipeLineLink2SQL('select pq.doctor, '+
'count(distinct pq1.vn) as total_OPD,count(distinct pq2.vn) as total_ER, '+
'count(distinct pq3.vn) as total_LR,count(distinct pq4.vn) as total_SS, '+
'count(distinct op.vn) as total_OPER,count(distinct pq.vn) as total_OPD_All, '+
'count(distinct o.vn) as total_ER2 '+
'from pq_doctor pq '+
'left outer join doctor d on d.code=pq.doctor '+
'left outer join ovst o on o.vn = pq.vn '+
'left outer join operation_list op on op.vn=pq.vn '+
'and op.request_doctor=pq.doctor and pq.doctor_date=op.request_operation_date '+
'left outer join pq_doctor pq1 on pq1.vn = pq.vn '+
'and pq1.doctor = pq.doctor and pq1.depcode in (001,002,003,004,005,006,007,008,022,032) '+
'left outer join pq_doctor pq2 on pq2.vn = pq.vn '+
'and pq2.doctor = pq.doctor and pq2.depcode = 011 '+
'left outer join pq_doctor pq3 on pq3.vn = pq.vn '+
'and pq3.doctor = pq.doctor and pq3.depcode = 014 '+
'left outer join pq_doctor pq4 on pq4.vn = pq.vn '+
'and pq4.doctor = pq.doctor and pq4.depcode = 023 '+
'where pq.doctor_date between "'+ds1+'" and "'+ds2+'" '+
'and pq.depcode in (001,002,003,004,005,006,007,008,022,032,011,014,021) '+
'and o.visit_type = "O" and d.position_id = "1" and code<>"145" group by pq.doctor ');