与 2 个字段组合的 IN 查询

IN query with combination with 2 field

我在 cosmos DB 文档中有一个设备列表(数千个),Make 和 SerialNumber 是每个资产的唯一标识符。

[{
    "make": "CAT",
    "serial": "A1",
    "NAME": "CAR"
},
{
    "make": "ZAT",
    "serial": "B1",
    "NAME": "BUS"
}, {
    "make": "CAT",
    "serial": "C1",
    "NAME": "TRUCK"
}, {
    "make": "ABC",
    "serial": "A1",
    "NAME": "Plane"
}, {
    "make": "ZAT",
    "serial": "A1",
    "NAME": "BIKE"
}
]

我需要根据以下输入设备输入从上述文档中获取资产的完整详细信息。

[{
    "make": "CAT",
    "serial": "A1"
},
{
    "make": "ZAT",
    "serial": "B1"
}, {
    "make": "CAT",
    "serial": "C1"
}
]

我正在使用下面的查询来获取完整的详细信息(我知道下面的查询是不正确的)。通常,我在单个查询中传递了 100 个串行设备。

select * from t where serial in (A1,B1,C1) and make in (CAT,ZAT,CAT)

有什么方法可以写出结合两个字段的IN查询吗?

预期结果

A1 猫

B1 ZAT

C1 猫

Pankaj Rawat,请使用此查询sql,它可以满足您的要求。

SELECT c FROM c where
ARRAY_CONTAINS([
    {"serialNumber":"A1","make":"CAT"},
    {"serialNumber":"B1","make":"ZAT"},
    {"serialNumber":"C1","make":"CAT"}
    ],
    {"serialNumber": c.serialNumber,
       "make":c.make}
    )

输出: