Mysql command history 发表于 2016-09-27 | 分类于 运维 | 暂无评论 更新销量update products p INNER JOIN (select oi.pid, count(oi.qty) as sales from orders_items oi INNER JOIN orders o on o.oid = oi.oid where o.status_payment = 1 GROUP BY oi.pid ) as t on p.pid = t.pid set p.sales = t.sales;