Only Aggregate Expressions Use Field Aliasing

If you’ve ever come across the following error in a SOQL statement in Salesforce:

Save error: only aggregate expressions use field aliasing, Force.com save problem

The issue is that you forgot a comma in your SOQL query! Indeed this will throw that error

SELECT
  Name
  Id
FROM
  Account

whereas this will not

SELECT
  Name,
  Id
FROM
  Account
This entry was tagged . Bookmark the permalink.

10 Responses to Only Aggregate Expressions Use Field Aliasing

  1. Uzair says:

    Thanks for this Article. It helped me.

  2. Gunjan Deogam says:

    Thanks for this Article. It helped me too :).

  3. VRPrasad says:

    Good Job Ray Dehler.

  4. debarshi says:

    Thanks for the ‘Ray’s of wisdom!!! It helped me.

  5. Mehdi_C says:

    It just helped me too today, thanks!

  6. venki says:

    Thank you very much.. It just helped me today.. thank you

  7. Jin says:

    THANK YOU!

    I was pretty clueless on that error message.

  8. Christian Ravera says:

    Thanks for your post.

    BTW, you can also get this if you have duplicate fields in your SELECT. For example:

    SELECT Id, Origin, Origin, Status, ContactId
    FROM Case
    WHERE …

Comments are closed.