Skip to main content
added 245 characters in body
Source Link
Dahn
  • 359
  • 1
  • 2
  • 7

This query is not going to work because you are not doing any aggregation.

HAVING clause only works on aggregations. Available aggregations in SOQL are: AVG(), COUNT(), COUNT_DISTINCT(), MIN(), MAX(), SUM().

If you want to perform your SOQL query, you should aggregate your FieldDouble field and group by groupable fields. Something similar (but maybe not exactly) to

Working example:

SELECT LeadSource, COUNT(FieldDoubleName)  
FROM Account Lead
GROUP BY FieldDouble LeadSource
HAVING COUNT(FieldDoubleName)>1 > 100

Documentation:

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_agg_functions.htm

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_having.htm

This query is not going to work because you are not doing any aggregation.

HAVING clause only works on aggregations. Available aggregations in SOQL are: AVG(), COUNT(), COUNT_DISTINCT(), MIN(), MAX(), SUM().

If you want to perform your SOQL query, you should aggregate your FieldDouble field. Something similar (but maybe not exactly) to:

SELECT COUNT(FieldDouble) FROM Account GROUP BY FieldDouble HAVING COUNT(FieldDouble)>1 

This query is not going to work because you are not doing any aggregation.

HAVING clause only works on aggregations. Available aggregations in SOQL are: AVG(), COUNT(), COUNT_DISTINCT(), MIN(), MAX(), SUM().

If you want to perform your SOQL query, you should aggregate your FieldDouble field and group by groupable fields.

Working example:

SELECT LeadSource, COUNT(Name) 
FROM Lead
GROUP BY LeadSource
HAVING COUNT(Name) > 100

Documentation:

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_agg_functions.htm

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_having.htm

Source Link
Dahn
  • 359
  • 1
  • 2
  • 7

This query is not going to work because you are not doing any aggregation.

HAVING clause only works on aggregations. Available aggregations in SOQL are: AVG(), COUNT(), COUNT_DISTINCT(), MIN(), MAX(), SUM().

If you want to perform your SOQL query, you should aggregate your FieldDouble field. Something similar (but maybe not exactly) to:

SELECT COUNT(FieldDouble) FROM Account GROUP BY FieldDouble HAVING COUNT(FieldDouble)>1