mysql: select, insert, delete and update in one query

后端 未结 4 1875
一个人的身影
一个人的身影 2020-12-21 09:46

i need in one query use select, insert, delete and update.

(I need copy data from old table in to new, then delete old, and update another).

Insert and selec

4条回答
  •  渐次进展
    2020-12-21 10:11

    You can't do it all in one query, but you can do it all in one transaction if you are using a transactional store engine (like InnoDB). This might be what you want, but it's hard to tell only using the information you provided in your question.

    START TRANSACTION;
    
    INSERT...;
    DELETE...
    UPDATE...;
    
    COMMIT;
    

提交回复
热议问题