You need to sign in to do that
Don't have an account?
Abhishek Sharma 527
Merge of 2 SOQL queries
Hello Dev, I'm trying to merge 2 SOQL queries into one. I don't know with which field it can be linked between case and event because when I'm trying with query -
it doesn't return anything. I believe with WhatId it can be linked but not getting proper way to implement this.
My 2 queries are -
Please if anyone can guide on this. It will be great help !!
Select Subject, Id, Facilities__c from event WHERE Event.WhatId = case.id
it doesn't return anything. I believe with WhatId it can be linked but not getting proper way to implement this.
My 2 queries are -
List<Event> nonBill = [Select Subject, Id, Facilities__c, Services__c, Appointment_Status__c, OwnerId, WhoId,ActivityDateTime, ActivityDate, WhatId,Facilities__r.Address_1__c,Facilities__r.City__c, Facilities__r.Name,Facilities__r.Country__c, Sup_Provider__c,Sup_Provider__r.Name, Owner.FirstName, Owner.MiddleName, Owner.LastName,EndDateTime, Facilities__r.State__c, Sup_Provider__r.Provider_Role__c FROM Event WHERE IsRecurrence = false AND Appointment_Status__c = 'Non-Billable']; List<Case> sessionRecords = [SELECT Id, CaseNumber, Type, RecordTypeId, Status, Reason, Origin, Subject, Priority, Description, CreatedDate, CreatedById, Comments, Duration__c, To_DOS__c, DC_Unit__c, First_Bill_Date__c, Last_Bill_Date__c, Appointment_End_Time__c, Balance__c, Billed_Amount__c, Appointment_Start_Time__c,Cal_Bal_Amt__c, Cal_Total_Patient_Bal__c,Practice_Insurance_Service__c, Client_Insurance__c, Sup_Provider__c, Claim_Number__c, Session_Summary__c, DOS__c, Labels__c,Enter_Bill_Amount__c, Total_Billed_Units__c, Total_Amounts__c, Session_Notes__c, Provider__c, Practice__c, Session_Note_Status__c, Unit__c, PA_NO_PA__c, Client_Name__c,Provider_Name__c, Location_Name__c, Insurance_Name__c, Authorization_Number__c, Self_Pay__c, Billable_Duration_in_Minutes__c, Non_Billable_Duration_in_Minutes__c,Non_Billable_Unit__c, Session_Completed_By__c FROM Case];
Please if anyone can guide on this. It will be great help !!
Regarding the first query do you have any events that are related to the Case object?
Because you said you are not getting results for query 1.
For the second once you said you want to combine two queries, Can you confirm what exactly do you need from those tqo queries. Do you need list of cases related to the Event ids ?
Thanks,
I don't see any attachment in your comment. Can you upload if possible.
Thanks,