N1QL - My query get error

n1ql

#1

I using N1QL to query data from Couchbase Server, but get error:

select p.name as StarActitity, ARRAY_AGG(v.name) as StarJobTitle FROM
`v-profiles` v 
JOIN `v-profiles` p   
ON KEYS v.starActivityAlias = p.alias
where v.type = 'starJobTitle'
AND p.type = 'starActivity'
GROUP BY p.name
order by StarActitity

Error:
[
  {
    "code": 3000,
    "msg": "Ambiguous reference to field p."
  }
]

I want to join same bucket on v.starActivityAlias = p.alias


#2

Hi,

Please see the tutorial and docs for examples of the JOIN syntax.