How to join the same bucket?

I have documents in the same bucket with two doc.type.
How can I JOIN them using N1QL?
Like:

Select * from bucket as a where a.type = 'typeA'
JOIN 
select * from bucket as b where b.type = "typeB"
ON a.TypeBId = b.Id

Thanks

Hello,

You can use:

Please see the documentation and examples for more details.

Dear @geraldss, default condition JOIN BY “Id”? If i want JOIN by other field, ex: name, email…, can N1ql do?
Thank you.

Hi @Sonrobby,

JOINs in N1QL do require that one document contain or compute the id / key of the other document. This is necessary for performance reasons.