title: Get Account lifetime value (sum of opportunities) and details
body: <p>I'm trying to get a table made of rows with Account details and the Sum of the Amount of the Opportunities for that Account.</p>
  
  <pre><code>SELECT Sum(Opportunity.Amount), Opportunity.AccountId FROM Opportunity GROUP BY AccountId
  </code></pre>
  
  <p>With this I get a simple list with the value I want and the AccountId.</p>
  
  <p>Now I'd also like the Account details like <code>PersonName</code>.</p>
  
  <p>How can I do that?</p>
  
  <p>I've tried this:</p>
  
  <pre><code>SELECT Sum(Opportunity.Amount), Opportunity.AccountId, Account.PersonName 
  FROM Opportunity
  GROUP BY Opportunity.AccountId
  INNER JOIN Account WHERE Account.Id=AccountId
  </code></pre>
  
  <p>But I get <code>Unknown error parsing query</code>. Why?</p>