0
votes

All i want to do is to retrieve information from two standard objects Account and Case. For I have tried joins(which later I found does not work with SOQL), relationships (which does not exist in my case. except for default relationship). Following is another attempt using sub query: (By default relationship I mean that Id in Account is same as AccountId in Case)

Select Phone,City__c,CreatedDate,Name, (SELECT Customer_Satisfaction_Level__c,Product_Category__c FROM AccountId__r) FROM Account;

Also, SOQL does not allow aliases which would have helped me as I am working with QlikView. Please Help!

2
can you ask this question on salesforce.stackexchange.com?Ganesh Bhosle

2 Answers

0
votes

Use This Below Query...Hope itz might be favourable for you

Select Phone,City__c,CreatedDate,Name, (SELECT Customer_Satisfaction_Level_c FROM AccountId_r where AccountId__r.ID=ID ) as Customer_Satisfaction_Level__c,(SELECT Product_Category_c FROM AccountId_r where AccountId__r.ID=ID ) as Product_Category__c FROM Account;

0
votes

You can select Accounts with related Cases like this:

List<Account> accounts = [Select Id, (Select Id From Cases) From Account];

And then iterate over results:

for (Account account : accounts) {
   for (Case case : account.Cases) {
      ...
   }
}