0

I would like to modify the following code to do a "batch" insert and using a where clause with values provided in the array..

Code is taken from the provided link : MySQL: Insert record if not exists in table

INSERT INTO table_listnames (name, address, tele)
VALUES ('Rupert', 'Somewhere', '022')
WHERE NOT EXISTS (
    SELECT name FROM table_listnames WHERE name='value'
);
Community
  • 1
  • 1
airnet
  • 2,245
  • 4
  • 27
  • 33
  • Have you any error and what you want? – Sadikhasan Jun 25 '14 at 08:04
  • I don't know how to modify the where clause for batching purposes – airnet Jun 25 '14 at 08:05
  • The INSERT doesn't support the WHERE clause (as given in an answer in the item you linked to). INSTEAD OF VALUES... you can use a SELECT and within that check the WHERE. Can you give a few more details of the batch and the array, and how the value to check relates to the values being inserted? – Kickstart Jun 25 '14 at 08:27

0 Answers0