I have a table called scheduler_sched which has several columns, including a column called schedule_id.
I need a function where I can pass 2 ids (copy_from_id, copy_to_id) as parameters. And what I need to do is take every row where schedule_id = copy_from_id AND duplicate it but change the copy_from_id to the copy_to_id
So basically I want to to the equivalient of this:
UPDATE scheduler_sched SET schedule_id = 32 WHERE schedule_id = 28
Only I do not want to UPDATE any rows, I want to create duplicates with the new ID's
Does this make sense?
How can I do this?
THANKS!
(By the way schedule_id is not a unique/index field on this table)