How to write nested N1QL batch read?

I have stored below data in couchbase:

When I am reading I will have key in second row i.e. 0001410005……………sku1 as input and based on this key I’ll retrieve guid; value of which is the key for first row i.e. <PriceInvRspRow1 .toString()>

Note that the value in first row is serializedDocument data not JSONDocument.

I have written below query to retrieve this data:
Statement fluentStatement =
Select.select("*")
//Expression.i escapes an expression with backticks
.from(i(dsBucket.name()))
//Expression.x creates an expression token that can be manipulated
//Expression.s creates a string literal
.where(x(“META(default).id”).eq(x( Select.select(“guid”)
//Expression.i escapes an expression with backticks
.from(i(dsBucket.name()))
//Expression.x creates an expression token that can be manipulated
//Expression.s creates a string literal
.where(x(“META(default).id”).eq("$1"))

            )));

But I am getting error:
[{“msg”:“Duplicate subquery alias default”,“code”:4020}]

Can you plz tell me where I am doing wrong and what is the best way to achieve this.

Thanks in advance.

Hi,

You need to use AS with your keyspace names. Each AS should supply a different alias.

Thanks Gerald,

Can you plz rewrite above query using AS. I am not getting any example code.

Thanks in advance.

For example with AS.

SELECT *
FROM mybucket AS doc1
JOIN mybucket AS doc2...