You need to sign in to do that
Don't have an account?

Do I need 2 queries?
Hello - Hoping to get help with this query. When a lead is created and if it has either a Core number or a PC Account Id number, I look for an account with that matching core number or pc Id.
The problem with this query is, if a lead had a core number but no pc id, the query returns a non matching account because it returns any account that has no pc id.
Do I need 2 different queries? One that looks for Core Number and another that looks for PC ID?
acctList = [SELECT Id, Core_Number__c, PC_Account_Id__c FROM Account WHERE Core_Number__c = :coreNumberTextList
OR PC_Account_Id__c = :pcAccountIdList LIMIT 1];
The problem with this query is, if a lead had a core number but no pc id, the query returns a non matching account because it returns any account that has no pc id.
Do I need 2 different queries? One that looks for Core Number and another that looks for PC ID?
acctList = [SELECT Id, Core_Number__c, PC_Account_Id__c FROM Account WHERE Core_Number__c = :coreNumberTextList
OR PC_Account_Id__c = :pcAccountIdList LIMIT 1];
you can try to put queries in conditions or you can try this.
Let me know if you have any issue and if it solves your problem please choose it as the best answer as it will help other having same problem.
All Answers
you can try to put queries in conditions or you can try this.
Let me know if you have any issue and if it solves your problem please choose it as the best answer as it will help other having same problem.