1

Here I am using the same document in left join as well:

select A.a,A.b,C.c
from Inventory A left join
     (select B.a as id,B.a*100 as c
      from Inventory B
      where condition1 and condition2
     ) as C
     on C.id
     on A.a

How could I achieve this without a left join in the above use-case?

Daniel_Knights
  • 7,940
  • 4
  • 21
  • 49

2 Answers2

1

Cosmos DB only support self-join by now.You can refer to this documentation.Left join is in Cosmos DB Development Team plan,and tentative start for H2 2020.You can track this feature here.

Steve Johnson
  • 8,057
  • 1
  • 6
  • 17
0

Assuming that on C.id on A.a is a typo and is really meant to be on C.id = A.a:

select a.a, a.b, c.c
from inventory a 
left join 
(
  select b.a as id, b.a * 100 as c
  from inventory b
  where condition1 and condition2
) as c on c.id = a.a;

equals

select a.a, a.b, 
  (
    select b.a * 100
    from inventory b
    where condition1 and condition2
    and b.a = a.a
  ) as c
from inventory a;
Thorsten Kettner
  • 89,309
  • 7
  • 49
  • 73