0

I have the parent child relationship table where I provide the data for the job timings of employee on the basis of days(sunday,monday...)..but it will be stored as 30 days in calendar object as ( from as date time picklist, to as date time picklist,day as the weekday picklist)..now i want to get the from and to when i give the day and id of the employee.So as i do not require all 30 records i used group by day. the From_c is also picklist values where picklist contains times from 7 am,7.30 am,8 am and so on.

this is the following query

Select c.Day__c,c.From__c,c.To__c  From Calendar__c c 
       where  c.Employee_Shift='a0bj00000006Z7vAAE' group by c.Day__c 

I am getting the following error.

Malformed query: field must be grouped or aggregated.

Please help me to solve this.

1
  • shouldn't Employee_Shift also have a __c after it?
    – Novarg
    Oct 1, 2015 at 9:12

2 Answers 2

0

Can you provide more details in your question? What are you trying to achieve?

When using group by with SOQL, aggregate functions can be used, but I don't think you can use other fields in your query https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_agg_functions.htm

Select c.Day__c,count(c.Id) From Calendar__c c where c.Employee_Shift='a0bj00000006Z7vAAE' group by c.Day__c

-1

Maybe it's a problem with not using aggregate functions in query - you usually group objects to get cumulative sum or count of field values. Try adding a aggregate function to a query and see where it takes you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .