3

I have two containers in Cosmos DB and I need to do an inner join between them.

Exemple:

VD_VENDAS 
VD_ESTOQUE
VD_COMPRAS

I need to do inner join between VD_VENDAS and VD_ESTOQUE. I try it:

SELECT v.obraId
FROM VD_VENDAS v
JOIN VD_ESTOQUE e IN v.obraId

But it doesn't work. How can I do it ?

David Makogon
  • 69,407
  • 21
  • 141
  • 189

1 Answers1

7

Cosmos DB's JOIN is only for self-joins (joining against data within the same document). There is no way to run a query that performs a join across multiple containers.

To accomplish something similar to what you want, you'll need to run two queries: one against each container (with whatever filtering you need to do). And how you write those queries is really up to you.

David Makogon
  • 69,407
  • 21
  • 141
  • 189