林中侠客

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

UPDATE mall_order mo
LEFT JOIN mall_order_goods mog ON mo.id = mog.order_id
SET mo.ratio=0.08
WHERE
mog.brand_id IN (409,417)

UPDATE mall_order mo
LEFT JOIN mall_order_goods mog ON mo.id = mog.order_id
SET mo.income=mog.income
WHERE
mog.income>0 and mo.income=0 and mo.goods_type=3 and


update mall_order set technical_charge = round_format(ratio*real_amount) where goods_type=3 and ratio>0 and technical_charge=0


select GROUP_CONCAT(id) as id,ratio from mall_brand group by ratio


SELECT
mo.id
FROM
mall_order mo
LEFT JOIN mall_order_goods mog ON mo.id = mog.order_id
WHERE
mog.brand_id IN (409,417)

 

 

多表联合删除

DELETE dotdee_uniform_settlement
FROM
dotdee_uniform_settlement
LEFT JOIN mall_order ON dotdee_uniform_settlement.orderid = mall_order.id
WHERE
mall_order.pay_status = 0
AND mall_order.`status` = 3
AND dotdee_uniform_settlement.settlement_status = 0

posted on 2016-01-04 10:23  林中侠客  阅读(330)  评论(0编辑  收藏  举报