码迷,mamicode.com
首页 > 数据库 > 详细

Mysql多表联合更新、删除

时间:2018-11-06 19:29:40      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:user   delete   bsp   upd   color   nbsp   mysql   inner   mes   

            UPDATE snyts_user u
            INNER JOIN snyts_order o
            ON u.user_id = o.user_id
            INNER JOIN snyts_refund_order r
            ON o.order_id = r.order_id
            SET u.training_times = u.training_times - 1
            WHERE r.refund_order_id = :refundOrderId

            DELETE ucr FROM snyts_user_class_rel ucr
            INNER JOIN snyts_order o
            ON ucr.user_id = o.user_id AND ucr.class_id = o.class_id
            INNER JOIN snyts_refund_order r
            ON o.order_id = r.order_id
            WHERE r.refund_order_id = :refundOrderId

 

Mysql多表联合更新、删除

标签:user   delete   bsp   upd   color   nbsp   mysql   inner   mes   

原文地址:https://www.cnblogs.com/feibazhf/p/9917055.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!