+ Start a Discussion
vivek ravivivek ravi 

can we use soql query in set method

im just wan o control the dublicate in emails ids in the contacts in accoun so that i wan to use set method

can i write my query like this

set <contact> conids=[select id,email from contact where id=:accountid];
set <id> contactemail=new set<id>();
for(contact con:conids)

can i write like this
if any one knw help me in this
Refer below, 


Ulas KutukUlas Kutuk
No you can not query like this. Should query w/ using List and then you can itare over list and add to whatever Set you want.