In ordinary projects, I often encounter this problem: I need to update and query data in one bid at the same time. For example, if there is a table of data as shown below, the update operation now needs to be: update the name value of status=1 to the name value of id=2 Usually we think of the following statement to achieve this requirement: However This completes the operation in the question. The general process is: query the data of id=2 as the intermediate table t; query the set data from the t table; perform the update operation so that you do not update and select the same table in the same statement, because this is equivalent to operating two tables, tb_test and the intermediate table t. The final result is as follows: You may also be interested in:
|
<<: Encapsulate a simplest ErrorBoundary component to handle react exceptions
>>: How to count the number of specific characters in a file in Linux
Mysql limit paging statement usage Compared with ...
I have seen some dynamic routing settings on the ...
I used Vue.js to make a nine-grid image display m...
I have been using the CentOS purchased by Alibaba...
Detailed explanation of the implementation method...
1. Download Python 3 wget https://www.python.org/...
How to write configuration files and use MyBatis ...
1) Enter the folder path where the jdk file is st...
Table of contents Single thread asynchronous Sing...
This article uses examples to describe the operat...
1. Why create an index? (Advantages) This is beca...
1. First, download the latest version of MySQL fr...
This article shares the specific code of NodeJS t...
An at-rule is a declaration that provides instruc...
Table of contents Current Issues Solution process...