这是我的选择查询,工作正常:
SELECT PRICE.PRICEDATETO AS PDF
,ATTR.PRICEDATEFROM AS ADF
,ATTR.PRICEDATETO AS ADT
FROM RT_DATA_CORE DCORE
INNER JOIN RT_DATA_PRICE PRICE ON DCORE.ID=PRICE.ID
INNER JOIN RT_PRODUCT_CORE PCORE ON PCORE.ID=PRICE.PRODUCTID
INNER JOIN RT_DATA_PRICEATTRIBUTES ATTR ON
CONCAT(ATTR.PRODUCTID,'_V')=PCORE.SKU
AND PRICE.ID='PRICE-26095657'
AND ATTR.PRICEDATETO>NOW()
ORDER BY ATTR.PRICEDATETO ASC LIMIT 1;
我需要将其更新为ADF = PDF
我正在尝试这个给我一个错误:
的MySQL> UPDATE RT_DATA_PRICE PRICE INNER JOIN(选择PA.PRICEDATETO作为DATER,PCORE.ID作为PID来自RT_DATA_PRICEATTRIBUTES PA,RT_PRODUCT_CORE PCORE,其中PA.PRICEDATETO> NOW()和PCORE.SKU = CONCAT(PA.PRODUCTID,'_ V')ORDER BY PA.PRICEDATETO ASC限制1)AOP.OPD = PRICE.PRODUCTID和PRICE.ID ='PRICE-26095657'Set AOP.DATER = PRICE.PRICEDATETO; 错误1288(HY000):UPDATE的目标表AOP不可更新
答案 0 :(得分:0)
表格RT_DATA_CORE
未被使用,因此我已将其删除,请尝试此操作
UPDATE RT_DATA_PRICE PRICE, RT_PRODUCT_CORE PCORE, RT_DATA_PRICEATTRIBUTES ATTR
SET ATTR.PRICEDATEFROM = PRICE.PRICEDATETO
WHERE
PCORE.ID=PRICE.PRODUCTID
CONCAT(ATTR.PRODUCTID,'_V')=PCORE.SKU
AND PRICE.ID='PRICE-26095657'
AND ATTR.PRICEDATETO>NOW();