且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Azure Cosmos db(SQL)中查询不同文档的最后数据

更新时间:2023-02-14 11:36:22

请尝试以下操作:

SELECT max(c.ts) as ts, c.age FROM c where c.age in (20, 30, 40) 
Group By c.age

这将提供以下输出:

[
    {
        "ts": "00:02",
        "age": 40
    },
    {
        "ts": "00:01",
        "age": 30
    },
    {
        "ts": "00:01",
        "age": 20
    }
]