ผมปรับแก้ประมาณนี้ครับ
ChangeDBPipeLineLink6SQL('select p1.vn as vn,p1.physic_items_id as item_list,p1.doctor as doctor_code, '+
'p2.name as item_name,d.name as doctor_name, '+
'concat("[กายภาพ] ",if(p2.name is null," - ",p2.name)," # ",if(d.name is null," - ",d.name)) as PH_name,concat(" ประเภท : ",pg.physic_group_name) as health_med_service_operation_time_minute '+
'from physic_list p1 '+
'left outer join physic_items p2 on p2.physic_items_id = p1.physic_items_id '+
'left outer join doctor d on d.code = p1.doctor '+
'left outer join physic_group pg on pg.physic_group_id=p1.physic_group_id '+
'where vn = "'+DBPipeline['vn']+'" '+
'union '+
'select h2.vn as vn,h3.health_med_operation_item_name as item_list,h1.health_med_provider_id as doctor_code, '+
'"" as item_name,h1.health_med_provider_id as doctor_name, '+
'concat("[แผนไทย] ",if(h3.health_med_operation_item_name is null," - ",h3.health_med_operation_item_name)," # ",if(h4.health_med_provider_full_name is null," - ",h4.health_med_provider_full_name)) as PH_name,concat("ใช้เวลา : ",h1.health_med_service_operation_time_minute," นาที") as health_med_service_operation_time_minute '+
'from health_med_service_operation h1 '+
'join health_med_service h2 on h2.health_med_service_id=h1.health_med_service_id '+
'join health_med_operation_item h3 on h3.health_med_operation_item_id=h1.health_med_operation_item_id '+
'join health_med_provider h4 on h4.health_med_provider_id=h1.health_med_provider_id '+
'where h1.health_med_operation_type_id="2" and vn = "'+DBPipeline['vn']+'" ');