The following query fails with this error message:
Illegal assignment from Account to List
list <account> actlist = [select account.id from contact ].account;
The following query is successful but I want all the accounts, not just 1...
list <account> actlist = new list <account>{[select account.id from contact limit 1].account};
I have two questions:
- Is there anything I can do to the first statement to get all of the accounts into variable actlist? I tried syntax like
list <account> actlist = [[select account.id from contact ].account];
andlist <account> actlist = [select account.id from contact ].account[];
- Is there any way I can select from CONTACT and end up with a list of ACCOUNTs in a single line of code?