Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试编写 mysql 查询,其中我有两个 where 子句,因此带括号的层次结构类似于(其中 x 和 y)或(其中 m 和 n)。
$value = db_query(" SELECT id, b,c FROM {grant_status} WHERE b='%s' AND b_val='%s' OR WHERE c='%s' AND c_val='%s' ", $name,'val', $name,'val');
这不是评估,我想知道它是否写得正确。
我相信你的意思
$value = db_query(" SELECT id, b,c FROM {grant_status} WHERE (b='%s' AND b_val='%s') OR (c='%s' AND c_val='%s') ", $name,'val', $name,'val');