I'm carrying out a query on Quote object. A Quote has an Opportunity which has an Account. Both Quote and Account objects have the field Vat_Rate__c. I'd like to run a query that returns all quotes where the Vat_Rate__c on the Quote and Account don't match.

I thought the following would work:

SELECT Id, Name FROM Quote WHERE Vat_Rate__c !=: Opportunity.Account.Vat_Rate__c

But this returns the error:

Unknown error parsing query

The following query runs without error:

SELECT Id, Name, Opportunity.Account.Vat_Rate__c FROM Quote LIMIT 1

So I know the field Opportunity.Account.Vat_Rate__c is referenced correctly.

Any ideas?

  • 1
    Use a formula field for the comparison. SOQL does not support field comparisons.
    – Phil W
    Jun 28, 2022 at 13:56
  • 1
    Field to field comparison is not allowed which you are doing in your query. Link for your reference- help.salesforce.com/s/….
    – Elijah
    Jun 28, 2022 at 14:22


You must log in to answer this question.

Browse other questions tagged .