I am trying to get a list of all Accounts with their related Cases. There is a lookup on the Case object to Account (AccountId). Right now I have to do two queries:
List<Account> stores = [
SELECT Account.Name
FROM Account
WHERE Account.Id IN (SELECT Case.accountId FROM Case)];
List<Case> predictions = [
SELECT Id, AccountId, CaseNumber
FROM Case
WHERE AccountId = :stores.get(i)
];
Is there anyway to do a nested SELECT in the Accounts query? I'm horrible with inner/outer joins.