You need to sign in to do that
Don't have an account?
Ignacio de la torre
How to compare field values from different not related Objects in a SOQL query?
Hi all !
I'm trying to get a Map<String, Contact> with the returned values of this comparison:
I've got two Objects, Contact (Standard) and DFJSON (Custom). These two objects are NOT related.
I need to Select the Contact Objects where Contact.SSN__c = DFJSON.SSN__c and so on with some other fields but I'm not being able to do so sience there's no JOIN in SOQL.
Any idea on how to do this ?
I'm trying to get a Map<String, Contact> with the returned values of this comparison:
I've got two Objects, Contact (Standard) and DFJSON (Custom). These two objects are NOT related.
I need to Select the Contact Objects where Contact.SSN__c = DFJSON.SSN__c and so on with some other fields but I'm not being able to do so sience there's no JOIN in SOQL.
Any idea on how to do this ?
If your objects are not related, then you cannot query two objects in SOQL.
However, if you happen to need to query to do a full-text search, then SOSL can run on multiple objects.
Below are working examples of SOSL for your reference.
https://apexcoder.com/2016/02/22/how-to-use-sosl-query-to-search-in-multiple-salesforce-objects/
https://trailhead.salesforce.com/en/content/learn/modules/apex_database/apex_database_sosl
https://www.sfdcpoint.com/salesforce/sosl-example-in-salesforce/
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL.htm
http://www.infallibletechie.com/2012/07/example-for-soslsalesforce-object.html
http://www.sfdcpanda.com/dynamic-sosl-query-on-the-fly-in-apex/
Hope above information was helpful.
Please mark as Best Answer so that it can help others in the future.
Thanks,
Vinay Kumar
Thanks for your reply David !
That is what I need to do but inside of a SOQL query, exactly !
I can't do it the way you're suggesting because I could eventually have thousands of contacts and DFJSON's and I don't want to iterate over each one of them .... that's why I'm trying the query approach !
Any idea ?
in batch Start method:
in execute method:
(https://cinemahdapkdownload.com)
I facing the same problem and now I fixed the problem from the expert's replies.
( https://cinemahdapkdownload.com )