码迷,mamicode.com
首页 > 其他好文 > 详细

INSERT into ... on duplicate key update ...

时间:2016-01-20 13:09:33      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

INSERT  into exception_report_total (
         waitFillOrders
        ,waitSendOrders
        ,changeOrders
        ,changeTotal
        ,waitProduceOrders
        ,wmsStockOrders
        ,erpStockOrders
        ,waitReserveOrders
        ,waitDispatchOrders
        ,addDispatchOrders
        ,waitCancel
        ,sendExceptions
        ,reserveOrders
        ,create_time
        ,carrier_id
        ,carrier_name
        ,dc_id
        ,dc_name
        ,org_id
        ,org_name
        )
        values
        <foreach collection="list" item="item" index="index" separator="," >
            (
            #{item.waitFillOrders}
            ,#{item.waitSendOrders}
            ,#{item.changeOrders}
            ,#{item.changeTotal}
            ,#{item.waitProduceOrders}
            ,#{item.wmsStockOrders}
            ,#{item.erpStockOrders}
            ,#{item.waitReserveOrders}
            ,#{item.waitDispatchOrders}
            ,#{item.addDispatchOrders}
            ,#{item.waitCancel}
            ,#{item.sendExceptions}
            ,#{item.reserveOrders}
             ,now()
            ,#{item.carrier_id}
            ,#{item.carrier_name}
            ,#{item.dc_id}
            ,#{item.dc_name}
            ,#{item.org_id}
            ,#{item.org_name}
            )
        </foreach>
        on duplicate key update
        waitFillOrders = values(waitFillOrders),
        waitSendOrders = values(waitSendOrders),
        changeOrders = values(changeOrders),
        changeTotal = values(changeTotal),
        waitProduceOrders = values(waitProduceOrders),
        wmsStockOrders = values(wmsStockOrders),
        erpStockOrders = values(erpStockOrders),
        waitReserveOrders = values(waitReserveOrders),
        waitDispatchOrders = values(waitDispatchOrders),
        addDispatchOrders = values(addDispatchOrders),
        waitCancel = values(waitCancel),
        sendExceptions = values(sendExceptions),
        reserveOrders = values(reserveOrders)

INSERT into ... on duplicate key update ...

标签:

原文地址:http://www.cnblogs.com/olmlo/p/5144704.html

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