How to subquery in where clause

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…

Try this.

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

@geraldss
awesome!
thank you very, very much!

1 Like