一个 where 子句中可以有多个子查询吗?
Can you have more than one subquery in a where clause?
我没有这方面的例子,但我只是想知道这样的事情是否在任何情况下都有效:
SELECT somefield
FROM sometable
WHERE something1 IN (SELECT somefield2 FROM sometable2)
AND something2 IN (SELECT somefield3 FROM sometable3)
一句话-是的。您可以在 where
子句中设置任意数量的条件,无论它们是否具有 in
条件。
是的。不过您的语法需要修正:
SELECT somefield
FROM sometable
WHERE something1 IN (SELECT somefield2 FROM sometable2)
AND something2 IN (SELECT somefield3 FROM sometable3)
我没有这方面的例子,但我只是想知道这样的事情是否在任何情况下都有效:
SELECT somefield
FROM sometable
WHERE something1 IN (SELECT somefield2 FROM sometable2)
AND something2 IN (SELECT somefield3 FROM sometable3)
一句话-是的。您可以在 where
子句中设置任意数量的条件,无论它们是否具有 in
条件。
是的。不过您的语法需要修正:
SELECT somefield
FROM sometable
WHERE something1 IN (SELECT somefield2 FROM sometable2)
AND something2 IN (SELECT somefield3 FROM sometable3)