update sales set sale_trigger_code=1 where sale_type_code=4;
update sale_details as sd left join sales as s on sd.sale_id=s.id set sd.price = sd.price * sd.quantity where s.sale_trigger_code=1 and sd.quantity != 0;
update sale_details as sd left join sales as s on sd.sale_id=s.id set sd.quantity = null, s.total_quantity=null where s.sale_trigger_code=1;
