Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT INTO table1 (title) SELECT title from table2 WHERE ...
- UPDATE table2 SET status='Used'
- start transaction;
- insert into table1(title) select title from table2 where foo=bar for update;
- update table2 set status= 'Used' where foo=bar;
- commit;
- INSERT INTO table1 (title)
- SELECT title FROM table2
- ON DUPLICATE KEY UPDATE status = 'Used'
Add Comment
Please, Sign In to add comment