How to subquery in where clause

n1ql

#1

hello.
2 type documents here,

#1.
{
“doctype”:“player”,
“userid”:10001,
“name”:“abc”
“level”:10
}
#2.
{
“doctype”:“pet”,
“userid”:10001,
“petname”:“ddd”
}

I need to extract “petname” list of level 10 users.
i try this.

select userid, petname
from bucket
where doctype = 'pet’
and userid in ( select userid from bucket where doctype = ‘player’ and level = 10);

what’s wrong???
please. help us…


#2

Try this.

select userid, petname
from bucket
where doctype = 'pet'
and userid in ( select RAW userid from bucket where doctype = 'player' and level = 10 );

#3

@geraldss
awesome!
thank you very, very much!