You need to sign in to do that
Don't have an account?
Steven Houghtalen
query to find out the number of groups
I have a custom object - services log, where I log every service performed for every client. I need to form a query to determine how many clients were served during a defined period. This query will be used in conjuction with Conga Composer to produce a report so I can't compliment the query with some apex code. Can anyone help me define a query that would do this? I am stumped.
Hi Steven,
I am assuming, services log is parent object which should have fields (ServiceStartDate) and (ServiceEndDate)
Client (Account/contact) is child object
Query must be like : -
List<Client> clnt_List = [Select Id,name from client where Service_Log__r.ServiceStartDate >: 2017-01-01T00:00:00Z and ServiceLogAPIName__r.ServiceEndDate :< 2017-02-09T00:00:00Z]
Here lookupRelationShip field : Service_Log__c
please let me know in case of any help or issue.
Thanks
Steven,
you can use aggregate query for finding the count of number of groups, just like in below sample code snippet -
I am taking account as a parent object and opportunity as a child object and I want to find the number of opportunities associated with account -