MySQL, update multiple tables with one query

前端 未结 6 1665
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 08:00

I have a function that updates three tables, but I use three queries to perform this. I wish to use a more convenient approach for good practice.

How can I update mu

6条回答
  •  攒了一身酷
    2020-11-22 08:48

    That's usually what stored procedures are for: to implement several SQL statements in a sequence. Using rollbacks, you can ensure that they are treated as one unit of work, ie either they are all executed or none of them are, to keep data consistent.

提交回复
热议问题