I’ve simple question.
I’m trying to on duplicate key update supplier name and price if new price is lower than actual.
Query looks like this and don’t work:
INSERT INTO import_queue (`IQ_ART_ID`,`IQ_PRICE`, `IQ_SUPPLIER`)
VALUES (2987621,'105.03', 'Supplier name')
ON DUPLICATE KEY UPDATE IQ_SUPPLIER =
IF(IQ_PRICE > 105.03, 'Supplier name', IQ_SUPPLIER) AND IQ_PRICE = IF(IQ_PRICE > 105.03,105.03, IQ_PRICE)
Thank you for any tips
The
updatesyntax seems a bit off. You’re missing theSETkeyword, and multiple columns should be separated by,notAND:Try this instead: