I need to join multiple document using n1ql query.
This is my document 1
{ "itemId": "item_6fdb36a8-60e1-4adc-a6f6-1ac07a30c66e",
"item_category": {
"catName": "a"
},
"item_name": "b",
"type": "item",
"_rev": "3-b07846b7433c2b245ade8089ea4fcb3e",
"_id": "item_.1e790a80-a8b4-40a1-a0e3-585e29eee8a2"
}
document 2
"itemId": "item_2c1ee3af-2f63-408b-afe7-cab2dd933bcb",
"item_category": {
"catName": "c"
},
"item_name": "d",
"type": "item",
"_rev": "3-b07846b7433c2b245ade8089ea4fcn9e",
"_id": "item_.1e970a80-a6b4-40a1-a0e3-585e26eee8h2"
}
document 3
{
"t_balance": 6.930000000000007,
"t_date_time": 1523344440000,
"t_discounts": [],
"t_id": "0ad6f991-1abd-4560-a5cf-87d9053b414a",
"t_invoice_no": "K058HG720",
"t_items": [
{
"category": a,
"itemId": "item_6fdb36a8-60e1-4adc-a6f6-1ac07a30c66e",
"name": "b-l",
"priceVariations": [
{
"price": "12",
"variationName": "Regular"
},
{
"price": "12",
"variationName": "s"
},
{
"price": "24",
"variationName": "l"
}
],
"selecteQty": 3,
"selectedDiscount": {
"discountId": "discount_cd3359fd-43c2-446c-969c-350b7aaa0cdc",
"discountName": "new year",
"discountType": "Rs",
"discountValue": 10
},
"selectedPrice": "62.00",
"selectedVariation": {
"price": "24",
"variationName": "l"
},
"type": "ITEM"
},
{
"category": c,
"itemId": "item_2c1ee3af-2f63-408b-afe7-cab2dd933bcb",
"name": "d-Regular",
"priceVariations": [
{
"price": "43",
"variationName": "Regular"
}
],
"selecteQty": 1,
"selectedDiscount": {
"discountId": "discount_b3916581-7a1a-40e6-aaa1-9c0026240d3e",
"discountName": "diwali",
"discountType": "%",
"discountValue": 4.5
},
"selectedPrice": "41.07",
"selectedVariation": null,
"type": "ITEM"
}
],
"t_value": 103.07,
"type": "txn",
"_rev": "3-665cf2397b8742b4bedd57557f6a1d67",
"_id": "0ad6f991-1abd-4560-a5cf-87d9053b414a"
}
document 1.itemId = document 3 . t_items. itemId
document 2.itemId = document 3 . t_items. itemId
i need to join document 1, 2 and document 3. I created query to join this documents. but i am getting error.
SELECT * FROM todo t JOIN todo s ON KEYS x.itemId UNNEST s.t_items AS x
error
Ambiguous reference to field x.