我有以下简单的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"
);
有人可以告诉我正确的语法,或许是为了做这个IN查询吗?
答案 0 :(得分:1)
文档支持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")
不支持:
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" );
如果您想在DocumentDB中查看子选择,请在DocumentDB's feedback page上投票赞成此功能,表达您的意见。