相关疑难解决方法(0)

Mysql或/和优先级?

我想知道如何和/和工作?

例如,如果我想获取display = 1的所有行

我可以做 WHERE tablename.display = 1

如果我想要显示= 1或2的所有行

我可以做 WHERE tablename.display = 1 or tablename.display = 2

但是,如果我想获得display = 1或2以及任何内容,标签或标题所包含的所有行,该怎么办?hello world

逻辑将如何发挥作用?

Select * from tablename 
where display = 1 or display = 2 and content like "%hello world%" or tags like "%hello world%" or title = "%hello world%"
Run Code Online (Sandbox Code Playgroud)

我的猜测.但后来我可以通过几种方式阅读.

它是否读出:

 (display = 1 or display = 2) and (content like "%hello world%" or tags like "%hello world%" or title = "%hello world%")
Run Code Online (Sandbox Code Playgroud)

或者作为 …

mysql operator-precedence

16
推荐指数
2
解决办法
1万
查看次数

标签 统计

mysql ×1

operator-precedence ×1