I have two queries as follows: Is there a way to JOIN
them in one query using the Question__r.Id
?
(I know SOQL doesn't have JOINs, but maybe an alternative solution?)
List<Answer__c> l= [SELECT Answer__C,
Question__r.Id, Question__r.Name
FROM Answer__c WHERE Application__c = :appID];
List<Question_Category__c> q = [SELECT Order__c
Question__r.Id, Question__r.Name
FROM Question_Category__c WHERE Category__c = :catID];
I could make the above 2 queries and add them to a single map
as the outcome, but I wanted to see if there were any other elegant solutions.
Adding to the above, is there a way to add the results of a query to a map and specify Question__r.Id
as the key?
List<Question__c> ... FROM Question_Category__c
won't compile. Please review your question and edit.