Monday, January 27, 2014

Explain difference in COUNT() and COUNT(fieldname) in SOQL.

Explain difference in COUNT() and COUNT(fieldname) in SOQL.

COUNT()
COUNT() must be the only element in the SELECT list.
You can use COUNT() with a LIMIT clause.
You can’t use COUNT() with an ORDER BY clause. Use COUNT(fieldName) instead.
You can’t use COUNT() with a GROUP BY clause for API version 19.0 and later. Use COUNT(fieldName) instead.

COUNT(fieldName)
You can use COUNT(fieldName) with an ORDER BY clause.
You can use COUNT(fieldName) with a GROUP BY clause for API version 19.0 and later.
Read here in more detail about COUNT() and COUNT(fieldname)

No comments:

Post a Comment