" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode \n"+
" LEFT JOIN Set_WMSSparePart c ON a.PurchaseOrderNo= c.WMSDeliveryNote \n"+
" LEFT JOIN Set_WMSSparePart c ON a.PurchaseOrderNo= c.PurchaseOrderNo \n"+
" AND a.MaterialCode= c.MaterialCode \n"+
" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode,Amt FROM set_invoice WHERE version = '202109' GROUP BY materialcode,Amt ) d ON a.MaterialCode= d.MaterialCode \n"+