Today, there is such a requirement. If the logged-in person is a customer service representative, the order will be queried for "this customer service representative" and the orders that have not been matched with a customer service representative. At first, I thought of spelling "or assigned_id is null" directly in the SQL statement. After testing, I found that in this case, the other previous conditions are useless. In this case, the first condition i.server_org_id = 4 is no longer applicable. From this we can see that AND has a higher priority than OR. The previous AND statement is executed first, and then the following OR statement is executed. Therefore, the data retrieved is not the data I want. Later I thought about it again and found that I could first find out the corresponding assigned_id, as follows The only data found in this way is the assigned_id 153 Final version: Finally, all the correct data is read out. From this, we can see that () has a higher priority than AND. () is executed first, and then AND is executed. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
>>: Summary of practical skills commonly used in Vue projects
How to solve the problem of 1045 when the local d...
Let's talk about the difference first last, t...
Table of contents 1. Phenomenon 2. Solution 3. Su...
MySQL 5.7.27 detailed download, installation and ...
A Multi-Select is a UI element that lists all opt...
Before further analyzing why MySQL database index...
When writing a Dockerfile, include an entrypoint ...
HTML text formatting tags 標簽 描述 <b> 定義粗體文本 ...
It is no exaggeration to say that hyperlinks conne...
MySQL is a relational database management system ...
Logo optimization: 1.The logo image should be as ...
Table of contents Overview Performance.now Consol...
In the horizontal direction, you can set the cell...
To facilitate the maintenance of MySQL, a script ...