我有一个类似文件
{
"bucket_name": {
"0": 2,
"1": 107,
"2": 61,
"3": 428,
"username": "tester2",
"obj_type": 21,
"date": 1562416800
}
}
我该如何选择仅数字的json键,我尝试了类似的方法:
select 0 from bucket_name where obj_type=21 and username='tester'
但它返回:
[
{
"$1": 0,
},
{
"$1": 0,
},
{
"$1": 0,
},
]
答案 0 :(得分:0)
使用反引号(即转义标识符)https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/identifiers.html
SELECT `0`
FROM bucket_name
WHERE obj_type=21 AND username='tester';