I want to execute sub-query,for e.g.
SELECT a.user_id
FROM default
a
WHERE doc_type
= 'login’
AND EXISTS(
SELECT b._id
FROM default
b
USE KEYS a.user_id
WHERE doc_type
=‘owner’
);
It contain two different document using same ‘name’ and using one ‘name’ i want to access another…but unfortunately i am not getting any values…What am I missing?
The value of USE KEYS must be the actual key-value key of the document in the subquery, in this case b.
Is that the case here?
Basically my first document is like…
{
“user_name”: “ank”,
“password”: “123”,
“doc_type”: “login”,
“user_id”: “vid”
}
And my 2nd document is like…
{
"_id": “vid”,
“address”: “”,
“DOB”: “”,
“alternate_contact”: “”
}
In this i am trying to access the 2nd document …using ‘user_id’ of a first document.
I tried replying earlier. One document needs to contain the external key (primary key) of the other document.
1 Like