azure - 如何在 CosmosDB SqlAPI 中使用破折号查询属性?
问题描述
查询:我想获取所有在 3 月份出生的人的记录列表。
{
"details": {
"state": "CA",
"city": "San Fransisco",
"date-of-birth": { // there is a "-" in the key
"month": "March",
"year": "2000"
}
},
"personId": "person1",
"id": "id1"
},
{
"details": {
"state": "CA",
"city": "San Jose",
"date-of-birth": { // there is a "-" in the key
"month": "April",
"year": "2000"
}
},
"personId": "person2"
"id": "id2"
}
我希望 SQL 查询会是这样的,但出现错误:
select * from c where c.details['date-of-birth'['month']] = "March"
有人可以帮我查询吗?我确实尝试查看文档,但有点困惑。
解决方案
尝试这个
select * from c where c.details['date-of-birth'].month = "March"
推荐阅读
- encoding - 调用 API 返回编码字符
- javascript - 如何定义任何变量
jsp中的标记 - git - 你能用 GIT 存储 HDF5 文件吗
- r - 按id传播数据表
- vbscript - VBscript 将变量写入所需文件的替代方法(FSO.write 太慢)
- unit-testing - 用玩笑嘲笑 this.$parent.$on
- ruby-on-rails - elasticsearch 过滤器聚合 - 多个过滤器
- bootstrap-4 - 如何将 bootswatch 主题或 CDN 添加到 bootstrap-vue?
- java - 从 JAVA 到 Database 的数据库调用性能
- dynamic - 具有动态名称的 ssis 导入文件