Answer the question
In order to leave comments, you need to log in
Multiple SQL Insert does not work if one of the rows does not fall under the unique index condition.?
There is a unique index on several columns (Name, Datetime). I periodically make a request to another service and enter data into my table. I form a multiple Insert query, and first all the data is entered, and then when updating from the service, part of the data is the same and I enter the data into the table, but since the unique index blocks the entry, the entire query does not work.
I want to insert only those rows that are new. Those that have not changed, do not insert.
Example - I monitor the number of products :)) on the service
яблоки 29.10.2017 18:00:00 20(тонн)
груши 29.10.2017 18:00:10 60(тонн)
яблоки 29.10.2017 18:01:00 1000(тонн) //ИЗМЕНИЛОСЬ
груши 29.10.2017 18:00:10 60(тонн) //не ИЗМЕНИЛОСЬ- тоже отправлять на вставку,но эта строка не отработает из за уникального индекса
Answer the question
In order to leave comments, you need to log in
What dialect of SQL?
For MySQL - INSERT IGNORE or INSERT ... ON DUPLICATE KEY UPDATE
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question