mysql
INSERT INTO Z_RV(
DOC_NO,
CMMDTY_CODE,
SUPPLIER_CODE,
PLANT_CODE,
INV_LOCAT,
BATCH_NO,
SRC_SYS,
EXTERNAL_DOC_NO,
STORE_NO,
IS_FACTORY_DELIVERY,
SIMS_DOC_NO,
SIMS_DOC_ITEM_NO,
ACTIVITY_NO,
PRE_LOCK_DATE,
REQUIRE_DATE,
RV_QTY,
INIT_FLAG,
UPDATER,
CREATE_TIME,
UPDATE_TIME)
values(
:DOC_NO,
:CMMDTY_CODE,
:SUPPLIER_CODE,
:PLANT_CODE,
:INV_LOCAT,
:BATCH_NO,
:SRC_SYS,
:EXTERNAL_DOC_NO,
:STORE_NO,
:IS_FACTORY_DELIVERY,
:SIMS_DOC_NO,
:SIMS_DOC_ITEM_NO,
:ACTIVITY_NO,
:PRE_LOCK_DATE,
:REQUIRE_DATE,
:RV_QTY,
:INIT_FLAG,
:UPDATER,
:CREATE_TIME,
:UPDATE_TIME
)
ON DUPLICATE KEY
UPDATE <#if RV_QTY?? && RV_QTY!=''>
RV_QTY = RV_QTY + :RV_QTY,
</#if>
UPDATE_TIME = :UPDATE_TIME,
REQUIRE_DATE = :REQUIRE_DATE
这个SQL语句我需要实现先新增,新增不成功,再更新RV_QTY,UPDATE_TIME,REQUIRE_DATE,这三个字段,但是更新的时候我需要 更具CMMDTY_CODE SUPPLIER_CODE PLANT_CODE INV_LOCAT ACTIVITY_NO这五个条件更新,我需不需要加where条件,sql语句怎么修改