-2

If I say

SELECT count(id), field_one__c, field_two__c 
   WHERE field_once__c > 1 AND field_two__c < 6 
   GROUP BY field_one__c, field_two__c

could I have it only return groups where the size is more than 1? I understand there is a having clause, but I do not believe it works with 'where'

1
  • 4
    What makes you say 'having' doesn't work with 'where'? What's the actual query that's not working for you? Are you getting any errors when combining having and where?
    – Nick C
    Mar 17 at 3:03

1 Answer 1

4

The HAVING clause works perfectly fine for this requirement. Just remember it goes after GROUP BY.

SELECT ... FROM ... WHERE ... GROUP BY ... HAVING count(Id) > 1

You must log in to answer this question.

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