INSERT INTO yourTable (ID, PersonID, JobID, Verified) SELECT NULL, PersonID, MAX(JobID) + 1, 0 FROM yourTable GROUP BY PersonID UNION ALL SELECT NULL, PersonID, MAX(JobID) + 2, 0 FROM yourTable GROUP BY PersonID
NULL for the
ID column should force the database to assign the next sequence, assuming that
ID be an autoincrement column. If it is not, then maybe consider changing this. For each of the new records, the
JobID sequence is just continued, hence my use of
n+2. And you seem to be using zero as the default value of
Verified, so this was hard coded.