Join with subquery including empty value


#1

hi guys,
i have a problem with Tthe join operator using sub query request.
I am making a join request to join differents queries and it works. however, when the left query is empty the right side of join is ignored. Then i would like the right side to be integrated in the request when the left side is empty. I tried to use RIGHT OUTER JOIN but an error is generated (error on keyspace).

SELECT * FROM (SELECT product.id_stock, count() as total FROM (SELECT id_product, count() FROM mobstoreas quantite WHERE quantite.document = ‘quantite’ AND quantite.id_commerce = ‘commerce_ms00004’ GROUP BY quantite.id_product) as quantity JOIN mobstore as product ON quantity.id_product = product.id_product WHERE product.document = ‘produit’ GROUP BY product.id_stock ) as productQuantity JOIN mobstore as stock ON productQuantity.id_stock = stock.id_stock WHERE stock.document = ‘stock’;


#2
  1. As of now in N1QL Joins are evaluated to LEFT to RIGHT
  2. If LEFT side produces no items JOIN results 0 items (no need to evaluate the right side)
  3. At present right side of JOIN must be keyspace (next release you can have subquery)
  4. RIGHT Join is rewritten as LEFT JOIN after that if it violates item 3 then it raises error.