I have used JOIN in Azure Cosmos DB collection using SQL API to query documents.
I have two contact documents, one is with property Address and another one is without address.
I need to get the address list of all the persons(including the persons who is not having any address). I have used the below query to do this. But it gives the person list who is having address.
Is there any way to do LEFT JOIN?
Query:
SELECT base.FirstName, base.LastName, Address.City FROM ContactPerson base JOIN Address IN base.Address
Sample Document:
[
{
"FirstName": "Saravana",
"LastName": "Kumar",
"Address": [
{
"City": "aaaa"
},
{
"City": "bbbb"
}
]
},
{
"FirstName": "Jayanth",
"LastName": "T"
}
]
Expected output:
[
{
"FirstName": "Saravana",
"LastName": "Kumar",
"City": "aaa"
},
{
"FirstName": "Saravana",
"LastName": "Kumar",
"City": "bbbb"
},
{
"FirstName": "Jayanth",
"LastName": "T"
}
]
Actual Output:
[
{
"FirstName": "Saravana",
"LastName": "Kumar",
"City": "bbbb"
},
{
"FirstName": "Saravana",
"LastName": "Kumar",
"City": "bbbb"
}
]