gpt4 book ai didi

mysql - 你如何做一个 mysql WHERE something = 'something' OR ... (PHP)

转载 作者:行者123 更新时间:2023-11-29 01:22:13 25 4
gpt4 key购买 nike

是否可以像这样进行 OR 语句?

WHERE pR.projectRelationId = '$id[ 0 ]' OR '$id[ 1 ]' OR '$id[ 2 ]'
AND pR.type = 'yada' AND

还是必须不断重新声明比较:

        WHERE 
pR.projectRelationId = '$id[ 0 ]' OR
pR.projectRelationId = '$id[ 1 ]' OR
pR.projectRelationId = '$id[ 2 ]'
AND
pR.type = 'yada' AND

最佳答案

使用 IN:

pR.projectRelationId IN ('$id[ 0 ]', '$id[ 1 ]', '$id[ 2 ]')

关于mysql - 你如何做一个 mysql WHERE something = 'something' OR ... (PHP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17062837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com