Skip to main content
Sunny Bhatla (Citbank) 님이 #Salesforce Developer에 질문했습니다
Experts, I was asked a question recently that how can a Set<Id> be used to limit SOQL search results ?

I vaguely remeber all the multiple choices given .. but one of them was by using .containsAll .. have you ever seen such question or concept ? 
답변 1개
  1. 2019년 1월 4일 오전 1:23
    You can use it like this

     

    Set<String> names = new Set<String>();

    names.add('Test');

    names.add('Test2');

    System.debug([SELECT Name FROM Account WHERE Name IN: names]);

    Or some think like that

     

    SET<String> cnt = new SET<String>();

    for(Contact c : [Select Email From Contact]) {

    cnt.add(c.Email);

    }

    List<Contact> contactsWithValidEmail = [Select Email From Contact Where Email IN: cnt];

     
0/9000