【发布时间】:2016-06-23 20:20:27
【问题描述】:
是否可以对数组元素运行查询?似乎它在顶级项目上工作正常......假设我有这个 json:
{
"_id": "5769cfbf7e45b52e388bbc78",
"address": {
"street": "2 Avenue",
"zipcode": "10075",
"building": "1480",
"coord": [
73.9557413,
40.7720266
]
},
"borough": "Manhattan",
"cuisine": "Italian",
"grades": [
{
"date": "2014-10-01T00:00:00.000Z",
"grade": "A",
"score": 11
},
{
"date": "2014-01-06T00:00:00.000Z",
"grade": "B",
"score": 17
}
],
"name": "Vella",
"restaurant_id": "41704620"
}
是否可以使用 JSON_QUERY / JSON_VALUE 对 Grades[xxx].score 执行 where 子句? IE。我想退回所有 Grades.score 为 >= 17 的文件。
【问题讨论】:
-
我想你想使用
OPENJSON。我没有可用的 SQL Server 2016,所以我真的无能为力。
标签: sql json sql-server-2016