set t1.Bks=
(select max(t2.EndTime) from t_diaoyonglian0703 t2
where t1.TraceID=t2.TraceID and t2.Site='bks')-
(select MIN(t2.BeginTime) from t_diaoyonglian0703 t2
where t1.TraceID=t2.TraceID and t2.Site='bks')
where t1.Date='0703'
运行下列sql更新查询即可实现提问中的需求:update order,(select order_id,
sum(goods_num*goods_price) as m
from order_goods group by order_id) b
set order.goods_total=b.m
where order.order_id=b.order_id
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)