我有以下简单的Sql Where,其中我正在DocumentDB中尝试使用,但无法使其在Query Explorer中工作:
SELECT * FROM root.DocumentDbTest_AllFieldTypes f
WHERE f.field1 NOT IN (
SELECT g.field1 FROM root.DocumentDbTest_AllFieldTypes g
WHERE g.time = "09:12:34"
);
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我执行此IN查询的正确语法吗?
文档支持子句IN中的运算WHERE符;但它不支持子选择。
换句话说......这是支持的:
SELECT food.id,
food.description,
food.tags,
food.foodGroup,
food.version
FROM food
WHERE food.foodGroup IN ("Poultry Products",
"Sausages and Luncheon Meats")
Run Code Online (Sandbox Code Playgroud)
不支持此操作:
SELECT *
FROM root.DocumentDbTest_AllFieldTypes f
WHERE f.field1 NOT IN
( SELECT g.field1
FROM root.DocumentDbTest_AllFieldTypes g
WHERE g.time = "09:12:34" );
Run Code Online (Sandbox Code Playgroud)
如果您希望在 DocumentDB 中看到子选择,请通过在DocumentDB 的反馈页面上投票支持此功能来表达您的意见。