Cha*_*a K 2 mysql sql sql-server oracle
如何在SQL连接中指定多个条件?我知道A.key = B.key除此之外是强制性的,下面是否正确指定SQL中的多个条件?
ON (A.key=B.key and/or cond1 and/or cond2 ...etc)
Run Code Online (Sandbox Code Playgroud)
要么
ON (A.key=B.key where cond1 and/or cond2 ..etc)
Run Code Online (Sandbox Code Playgroud)
您可以在连接中指定任意数量的条件,例如:
ON A.Key=B.Key
AND b.value>100
AND (a.value>b.value OR b.value2 IS NULL)
Run Code Online (Sandbox Code Playgroud)