Multiple N1QL queries executed at once

I have multiple N1QL for Analytics queries that calculate stats on data in the bucket. Is there way to have all queries in one place to execute at once instead of executing each query individually? Something like stored procedure or view in sql when I am able to gather and structure results in one spot? Thank you.

Try this.

SELECT q1, q2, q3
LET q1 = (SELECT …),
q2 = (SELECT …),
q3 = (SELECT …);

I have a lot of queries and they all deep nested. Ideally I wanted to keep queries not in C# code, but stored somewhere in couchbase similar to how views and stored procedures reside in SQL Server.

1 Like

Couchbase Analytics currently does not provide storage for user-defined queries.

@evgeniya.bell,

Keep your eye on this ticket, as it’s something that will be eventually added to Couchbase Server, at least for N1QL (not sure about Analytics) - https://issues.couchbase.com/browse/MB-7591

1 Like

Don’t work.

“syntax error - at LET”,

Post the complete query and CB version, Service name.