SQL ANY 关键字
ANY
ANY
如果任何子查询值满足条件,则命令返回true。
以下SQL语句返回TRUE并列出产品名称,如果它在OrderDetails表中找到Quantity = 10的任何记录:
实例
SELECT ProductName FROM Products WHERE ProductID = ANY (SELECT ProductID FROM OrderDetails WHERE Quantity = 10);运行实例»
实例
SELECT ProductName FROM Products WHERE ProductID = ANY (SELECT ProductID FROM OrderDetails WHERE Quantity > 99);运行实例»