I want to copy one row from one table to another table. But in the process I want change value of id. For example to 20. How to do it?
I have this code
INSERT INTO work_done
SELECT * FROM work_todo
WHERE id = 10
Try somethink like tis
INSERT INTO work_done
( id
, col2
...
)
SELECT 20
, col2
...
FROM work_todo WHERE id = 10
select *
into work_done
from work_todo
where id = 10;
update work_done a
set a.id = 20;
OR
select case id
when id = 10
then id = 20
into work_done
from work_todo
where id = 10;