LEFT JOIN mes_unit_price mup ON RIGHT ( mur.product_code, 11 ) = mup.product_code
LEFT JOIN mes_unit_price mup ON RIGHT ( mur.product_code, 11 ) = mup.product_code
AND mur.childprocess_code = mup.childprocess_code
AND mur.childprocess_code = mup.childprocess_code
AND mup.line_code = mur.line_code
LEFT JOIN base_equipment be ON be.sap_code= mur.line_code
LEFT JOIN base_equipment be ON be.sap_code= mur.line_code
LEFT JOIN ( SELECT parent_order, SUM ( quantity ) AS total_quantity,SUM(quantity_feedback) AS order_quantity FROM mes_report_work GROUP BY parent_order ) mrw ON mur.workorder_code = mrw.parent_order
LEFT JOIN ( SELECT parent_order, SUM ( quantity ) AS total_quantity,SUM(quantity_feedback) AS order_quantity FROM mes_report_work GROUP BY parent_order ) mrw ON mur.workorder_code = mrw.parent_order
LEFT JOIN ( SELECT workorder_code, SUM ( quantity ) AS total_quantity,SUM(quantity_feedback) AS order_quantity FROM mes_report_work GROUP BY workorder_code ) mrws ON mur.workorder_code = mrws.workorder_code
LEFT JOIN ( SELECT workorder_code, SUM ( quantity ) AS total_quantity,SUM(quantity_feedback) AS order_quantity FROM mes_report_work GROUP BY workorder_code ) mrws ON mur.workorder_code = mrws.workorder_code