function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KunKun 

Apex Data Loader SQL command

Select Id, Billing_City__c, Billing_Country__c FROM Contact WHERE Billing_City__c = Billing_Country_c
 
From the above SOQL i will get a error message saying that "Billing_Country_c" must be a string that have ' '.
But the purpose of my SOQL is to find out whether Billing_City_c got any duplicates in Billing_Country_c
 
Can any1 help me?
 
Thanks
JerryJosephJerryJoseph
are you trying to retieve all records which has Billing_City_c = Billing_Country_c ??
JerryJosephJerryJoseph
try this

Select C1.Id, C1.Billing_City_c, C1.Billing_Country_c FROM Contact C1, Contact C2 WHERE C1.Billing_City_c = C2.Billing_City_c AND C1.Billing_City_c = C2.Billing_Country_c
KunKun
Dear Jerry,
 
The code u provided doesnt seems to work.
 
Thanks
jrotensteinjrotenstein
I don't believe it is possible, but I'd love to hear about a way to do it!

The SOQL documentation states that the Value after the Comparison Operator is not another field:
A value used to compare with the value in fieldName. You must supply a value whose data type matches the field type of the specified field. You must supply a native value—other field names or calculations are not permitted. For date values, use the formatting listed in Date Formats and Date Literals. If quotes are required (for example, they are not for dates and numbers), use single quotes. Double quotes result in an error.