2

是否可以做这样的 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
4

2 回答 2

6

使用IN

pR.projectRelationId IN ('$id[ 0 ]', '$id[ 1 ]', '$id[ 2 ]')
于 2013-06-12T10:11:36.370 回答
0

Use with IN

WHERE pR.projectRelationId IN ('$id[ 0 ]','$id[ 1 ]','$id[ 2 ]') AND pR.type = 'yada' AND
于 2013-06-12T10:12:41.943 回答