--更新未结算的订单 update a set a.statedate=b.rzdate,a.statetime='00:00:00' from t_order_head a, (select orderno,max(rzdate) as rzdate from t_accept_head a,t_pay_bill b where a.billno = b.billno and b.isaccounted='0' group by orderno) b where a.billno=b.orderno go --更新验收单业务日期 update a set a.bizdate=b.rzdate from t_pay_bill a, t_accept_head b where a.billno=b.billno go --更新退货单业务日期 update a set a.bizdate=b.rzdate from t_pay_bill a, t_return_head b where a.billno=b.billno go --更新进价调整单业务日期 update a set a.bizdate=b.rzdate from t_pay_bill a, t_adjbuyprice_head b where a.billno=b.billno go