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
manjirimanjiri 

In operator in SOQl queries

Can we use list of string for 'IN' operator for select statement.

like [Select field1,field2,.. from tablename where id IN stringlist]

 

Best Answer chosen by Admin (Salesforce Developers) 
Prafull G.Prafull G.

Yes, you can use List, Set for IN.

 

List<tableName> lst = [select field1, field2 from tableName where Id IN : stringList];

 

Regards,

crmtech21

All Answers

Prafull G.Prafull G.

Yes, you can use List, Set for IN.

 

List<tableName> lst = [select field1, field2 from tableName where Id IN : stringList];

 

Regards,

crmtech21

This was selected as the best answer
manjirimanjiri

Thanks for the quick reply

Ankit AroraAnkit Arora

You can use List , Set , Map.keySet with "IN" operator in query

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

LakshmanLakshman

Also you can use Nested queries to get an id.

Just like : Select name from Account where id IN (Select AccountId from Contact where Email = 'foxy@salesforce.com')