【发布时间】:2016-08-10 04:51:07
【问题描述】:
我正在尝试使用 VALUE 关键字结合其他特定字段来拼合 JSON 文档,但没有运气。
给定一个 Document DB 文档:
{
"id": "Tenant-Test",
"name": "Test",
"timeZone": "Eastern Standard Time",
"section1": {
"section1Key1": "section 1 value 1",
"section1Key2": "section 1 value 2",
...
},
"section2": {
"section2Key1": "section 2 value 1"
}
}
我想获取以下形状的数据子集:
{
"id": "Tenant-Test",
"name": "Test",
"timeZone": "Eastern Standard Time",
"section1Key1": "section 1 value 1",
"section1Key2": "section 1 value 2"
}
理论上我可以查询这个
SELECT c.id, c.name, c.timeZone, VALUE c.section1 FROM c
这会在“VALUE”附近出现语法错误。如果我删除特定字段 c.id、c.name、c.timeZone,那么我可以展平 c.section1。
是否可以进行这种转换?
【问题讨论】:
标签: sql azure azure-cosmosdb