質問

I am obviously missing something obvious, i'm trying to execute an SOQL query in some APEX code on Salesforce but this query just doesn't work, and i can't work out why, can somebody assist?

SELECT Id,Name,Amount,R2_Job_Ref__c,R2_Shipping_Post_Code__c,Shipping_Postcode_2__c
FROM Opportunity
WHERE Shipping_Postcode_2__c != R2_Shipping_Post_Code__c AND R2_Shipping_Post_Code__c != null

Thanks!

Gareth

役に立ちましたか?

解決

I don't believe this is possible.

According to http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_sosl_where.htm:

You must supply a native value—other field names or calculations are not permitted.

I think you have two options:

  1. Create a formula field that returns a value that you can filter
  2. Remove the clause and then filter it in memory (e.g. looping through the data and building a new data set)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top