+ Start a Discussion

Can I compare two columns with the Query Call?

I would like to perform a query like

Select Id, Name, Amount From Opportunity WHERE Amount != Some_Custom_Field__c

Is this possible... from what I have read in the docs, I gather the answer is no, but really really really want to be wrong.

Thanks for your help.
No, the filter value must be a literal value.

I was affraid of that.  Thank you for the prompt reply.
Create a formula field to do the comparison for you and return 1 or 0.  In your SOQL query, filter on the result of the formula field.