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
ravi k 26ravi k 26 

how to pass multile where conditions in single soql qurey

hi all,
   Can u help to that, how to pass multile where conditions in soql qurey in apex class, if posible let me know by  uing map , example
select name,,,,, from account where name='xxxxx',
select name from account where name ='' yyyyyy'
select name from account where anme ' zzzzz'
 can any one help to wite a querey to pass multiple conditions for same query..

thanks to all
 
 i
Amit Chaudhary 8Amit Chaudhary 8
Please try below code:-
List<String> lstName =new List<String>();
lstName.add('xxxxx');
lstName.add('yyyyyy');
lstName.add('zzzzz');

List<Account> lstAcc = [select id,Name from account where name in :lstName];


Please let us know if above code will help you.

Thanks
Amit Chaudhary
Vivek DeshmaneVivek Deshmane
Hi,
Try this and let me know.
List<String > lstAccNames = new List<String>{'xxxxx','yyyyyy','zzzzz'};
List<Account> lstAccountRecord=[SELECT ID,Name FROM Account WHERE Name IN :lstAccNames];

Best Regards,
-Vivek
ravi k 26ravi k 26
thx for answer  vivk and amit but  each select statement in different classes in apex class.  i need to pass where condition as arguement for my senario
Thanks