Reputation: 134
I want to insert multiple rows in a MySQL table at once. One of the columns, column c, of that table is unique indexed. How to write a query to insert the new rows(rows where value of column c is not equal to the column c value of any previously inserted row) only and ignore inserting duplicate rows?
Upvotes: 0
Views: 91
Reputation: 1062
You can use INSERT IGNORE instead of insert.Query will be like this .
INSERT IGNORE INTO person_tbl (last_name, first_name)
VALUES( 'Jay', 'Thomas');
Upvotes: 2