Trying to duplicate some rows in a table but just change the ssreportid
column from 4 to 6:
INSERT INTO ssreportparticipant (ssreportid, sssurveyparticipantid) VALUES SELECT 6, sssurveyparticipantid FROM ssreportparticipant WHERE ssreportid = 4
The error says #1064 near 'select 6, ...' but if I just run the select clause, it selects the records perfectly, with the new id of 6 in the ssreportid
column.
The table has a primary key called ssreportparticipantid, and there is a unique key on (ssreportid, sssurveyparticipantid). Note that the select clause creates new records that have unique key pairs, so that's not the problem. I have tried putting brackets around the select clause, and even using two aliases for the table, no joy.
Using server version 5.0.45.
Please tell me that programmer fatigue has me missing a comma or something.
Thanks,
-Josh