Hi Guys,
I am learning N1QL JOIN and I am finding it difficult to get it right even after reading a lot of examples and documentation. I have the below 2 documents in the same bucket and I want to join them to display the employee details along with its salary details. Can you please suggest the correct query ?
“id”: “SAL001”
{
“type”: “salary”,
“emp_no”: “101”,
“fixed_salary”: 10000,
“HRA”: 1000,
“travel_allowance”: 500,
“frequency”: “monthly”
}
“id”: “EMP001”
{
“firstname”: “John”,
“lastname”: “Smith”,
“emp_no”: “101”,
“type”: “employee”
}
I tried this but giving syntax error.
select P.* , Q.* from Products P INNER JOIN Products Q ON KEYS P.emp_no=Q.emp_no and P.emp_no=101