so, the following query is pretty self explanatory:
SELECT p.Accountid, p.Name, (select name FROM Account where id = p.Accountid) FROM Contact p order by accountid'
is there any way to do this in a single query? I'm looking to avoid this:
map accounts = new Map<String, String>();
for(Account a :[SELECT name, id FROM account])
{
accounts.add(id, name);
}
map mapc = new Map<String, Contact>();
for(Contact l: [SELECT accountid, name from contact order by accountid])
{
mapc.add(accounts[l.accountid], l);
}
(not debugged, but you get the idea)
and I cannot make a custom relationship to account, because my org admin doesn't want me to.
Thanks!