What is the use of mysql's or syntax
This article mainly explains "what is the role of mysql's or grammar". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the role of mysql's or grammar"?
Mysql or syntax is generally used for queries with multiple conditions, such as "SELECT * FROM WHERE p.`act _ type` = 4 or p.`act _ type` =."
The operating environment of this paper: Windows7 system, mysql8, Dell G3.
What is the use of mysql or?
Example of or statement usage in MySQL
The use of or syntax in 1.mysql, the use of or in mysql syntax. The project encountered a pit, traversing the issue of reward data query error!
$sql = 'SELECT * FROM `vvt_spread_doubleegg_exchange_ award` AS p WHERE p.`act _ type` = 4 or p.`act _ type` = 5 AND p.`user _ id` ='. $user_id
The or syntax in sql is generally used for queries with multiple conditions, and the above syntax query is equivalent to: two sets of data queried by sql.
$sql = 'SELECT * FROM `vvt_spread_doubleegg_exchange_ award` AS p WHERE p.`act _ type` = 4 =' SELECT * FROM `vvt_spread_doubleegg_exchange_ award` AS p WHERE p.`act _ type` = 5 AND p.`user _ id` ='. $user_id
two。 To query the data set act_type = 4 and user_id = 11123 or equal to p.`act _ type` = 5 and user_id = 11123, the conditions on both sides of the or must be added ().
$sql = 'SELECT * FROM `vvt_spread_doubleegg_exchange_ award` AS p WHERE (p.`act _ type` = 4 or p.`act _ type` = 5) AND p.`user _ id` ='. $user_id Thank you for your reading, the above is the content of "what is the role of mysql's or grammar". After the study of this article, I believe you have a deeper understanding of the role of mysql's or grammar, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!