update  0p4_invoice_items i left join 0p4_item it on i.item_id=it.item_id
left join 0p4_chart_account ca on ca.chart_account_id=it.selling_gl_code_id
set i.gl_code_id=it.selling_gl_code_id,i.gl_code=it.selling_gl_code,i.gl_name=ca.gl_name
where i.gl_code_id is null
