I have one table content, where in I am adding information regarding pages.
id history_id title body.
1 0 home this home
2 1 home here is sometext.
I am using history_id to keep track of changes made to the page, here I want to restore the changes made to the record id = 1
and simultaneously create new record with previous content.
I have tried this.
INSERT INTO content(id, history_id, title, body)
select id, history_id, title, body;
UPDATE content (SELECT title, body WHERE id = 1)
SET title = 'title', body='body';
it is successfully creating new record with previous content but not updating the current record. can anyone help me out how can I do update select ? and what changes should i have to made in here ? Thanks.