Geoff Millikan
asked on
MySQL > INSERT IGNORE INTO > Only inserts one row
Why is this query only inserting one row?
If I run the query again, I get:
CREATE TABLE search_terms_new (
search_terms_id mediumint(9) NOT NULL,
search_terms varchar(255) NOT NULL,
PRIMARY KEY(search_terms_id)
)
ENGINE = InnoDB
AUTO_INCREMENT = 0
GO
ALTER TABLE search_terms_new
ADD CONSTRAINT the_unique
UNIQUE (search_terms)
GO
INSERT IGNORE INTO server_logs.search_terms_new (search_terms_id,search_terms)
SELECT
LAST_INSERT_ID()+1,
search_terms
FROM
server_logs.search_terms
Result: 1 record(s) affected
[Executed: 10/28/2013 4:35:49 PM] [Execution: 5s]
If I run the query again, I get:
0 record(s) affected
[Executed: 10/28/2013 4:36:25 PM] [Execution: 4s]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks so much, that fixed it!
ASKER