Copying specific data in a db into the same db while changing a value

I have created a JSU_PY project that is working well but I was asked to provide a button to copy the values in the DB with specific identifiers in a column and copy them with a different identifier into the same DB. Basically two fixtures on a cell have the same JSU setups and instead of inputting everything twice they want to just duplicate with a different fixture ID. Not sure how to do this nor have I ever had to. It is many rows of info.

You would use an INSERT...SELECT statement. Something like this:

sql = """INSERT INTO someTable (my_id, a, b, c, d)
SELECT ? As new_id, a, b, c, d
FROM someTable
WHERE my_id=?"""

system.db.runPrepUpdate(sql, [to_id, from_id])
1 Like

That took care of it, like I doubted you!