是否可以像这样做一个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
答案 0 :(得分:6)
使用IN
:
pR.projectRelationId IN ('$id[ 0 ]', '$id[ 1 ]', '$id[ 2 ]')
答案 1 :(得分:0)
与IN
WHERE pR.projectRelationId IN ('$id[ 0 ]','$id[ 1 ]','$id[ 2 ]') AND pR.type = 'yada' AND