I am looking to copy 4 existing rows in a database and need to change the value of one of the columns in the new rows. I need to do this and also make sure that no duplicates are created. What I have so far is
INSERT INTO table (col1, col2, col3)
SELECT 141, col2, col3,
FROM table
WHERE col1 = 99 AND NOT EXISTS
(SELECT * FROM table WHERE col1 = 141, col2, col3)
However, when I try run this, I have a syntax error at the comma in my (SELECT * FROM table WHERE col1 = 141, col2, col3) row.
Can anyone help?
EDIT: I have 4 rows with the following values in my database
col1 | col 2 | col 3 |
---|---|---|
99 | 1 | Enabled |
99 | 3 | A |
99 | 4 | B |
99 | 5 | C |
and I want to create the following rows, but check for duplicates first
col1 | col 2 | col 3 |
---|---|---|
141 | 1 | Enabled |
141 | 3 | A |
141 | 4 | B |
141 | 5 | C |