You need to sign in to do that
Don't have an account?
SOQL query on junction objects
Hi
I am learning SOQL and am trying to figure this out. I have 2 custom objects and 1 junction object (which is a custom object too). Fields as below:
Custom Object 1: Question__c
Fields: Answer_Choice__c, Question_Name__c, Question_Text__c (and it has a default field Id for the Question ID)
Custom Object 2: Survey__c
Fields: Is_Complete__c, Survey_Name__c,
(and it has a default field Id for the Survey ID)
and the Junction Object: Question_Id__c, Survey_Id__c
Now I want to build a SOQL query so that I get the question_name__c, anser_choice__c from custom object 1 where the survey_id__c = :myVariable.
What is the best SOQL that can be used here?
Thanks
gm
I dint get any answers! :smileymad: Anyways I figured it out myself so thought of sharing it.
Select q.Therapy_Area__c, q.Question_Type__c, q.Question_Text__c, q.Question_Name__c, q.Name, q.IsDeleted, q.Id, q.CreatedDate, q.CreatedById, q.Answer_Choices__c From Question__c q where q.id in (Select s.Question_Id__c From Survey_Question__c s where s.Survey_Id__c = :myVar)
Thanks
gm