You need to sign in to do that
Don't have an account?
jaxdmaster
SOQL
Hi all,
Why below statement is working.
Map<Id,Account> mp = new Map<Id,Account>([select name from Account]);
System.debug(mp);
I am not selecting Id although code work fine. How is it working?
The id comes through automatically when you carry out a SOQL statement. Took me by surprise the first time it happened too!
select name from Account is nothing but
Select Id,name from Account.
Because the Id will automatically comes with your selected field values.