5

This question asked in interview. As per my knowledge, it's not possible to get in single query. Is it even possible?

If yes, then how? Please answer this question.

Thank You!

1
  • 5
    Here's what Salesforce says about that. Does this answer your question? Commented May 18 at 12:08

1 Answer 1

5

If the two fields are on the same record, this is approached by using a custom Checkbox formula field to do the comparison, then querying using that Checkbox field. E.g. the field might be Same_City__c and have a formula:

BillingCity == ShippingCity

You would then do:

SELECT Id FROM Account WHERE Same_City__c == TRUE

Similar can be done with cross-object formula fields as long as there is a direct relationship and the formula field is on the child record.

1
  • Shakespeare wrote "Horse a horse my kingdom for a horse" How many times have I thought when dealing with SF "SQL, SQL my project for SQL."
    – Ken
    Commented May 22 at 21:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .