update B,
(select sum(金额) as n from A
where 状态='F' and 时间<now()) t
set B.总金额=t.n
SELECTo1.order_id,
MAX(o1.subtotal) AS 订单总金额,
SUM(o2.cost) AS 订单明细合计
FROM
`order` o1 JOIN order_details o2 ON (o1.order_id = o2.order_id)
GROUP BY
o1.order_id
HAVING
MAX(o1.subtotal) <>SUM(o2.cost)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)