mysql查询出数据更新到另一张表

update mall_products p
inner join(
    select
        product_id ,
        sum(inventory_count) stock
    from
        mall_styles
    GROUP BY
        product_id
) as sty on p.id = sty.product_id
set p.stock = sty.stock
联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2024

备案号:京ICP备15003423号-3