update accept_orders as a 
  left join (
    select accept_order_id, SUM(quantity) AS total_quantity from accept_order_details group by accept_order_id
  ) as b on a.id=b.accept_order_id
  set a.total_quantity=b.total_quantity where updated_at > "2012-07-05";
  
update accept_orders as a 
  left join (
    select accept_order_id, SUM(quantity*price) AS total_price from accept_order_details group by accept_order_id
  ) as b on a.id=b.accept_order_id
  set a.total_price=b.total_price, a.total_duty = TRUNCATE(b.total_price * 0.05, 0) where updated_at > "2012-07-05";
  
  
  