title: SQL query involving group by and joins
body: <p>I couldn't be more specific in the title part but I want to do something a little bit complex for me. I thought I did it but it turned out that it is buggy.</p>
  
  <p>I have three tables as following:</p>
  
  <p>ProjectTable</p>
  
  <ul>
  <li>idProject</li>
  <li>title</li>
  <li>idOwner</li>
  </ul>
  
  <p>OfferTable</p>
  
  <ul>
  <li>idOffer</li>
  <li>idProject</li>
  <li>idAccount</li>
  </ul>
  
  <p>AccountTable</p>
  
  <ul>
  <li>idAccount</li>
  <li>Username</li>
  </ul>
  
  <p>Now in one query I aim to list all the projects with most offers made, and in the query I also want to get details like the username of the owner, <s>username of the offerer*</s> etc. So I don't have to query again for each project.</p>
  
  <p>Here is my broken query, it's my first experiment with GROUP BY and I probably didn't quite get it.</p>
  
  <pre><code>SELECT Project.addDate,Project.idOwner ,Account.Username,Project.idProject,
      Project.Price,COUNT(Project.idProject) as offercount 
  FROM Project 
  INNER JOIN Offer 
      ON Project.idProject= Offer.idProject 
  INNER JOIN Account 
  ON Account.idAccount = Project.idOwner  
  GROUP BY Project.addDate,Project.idOwner,
      Account.Username,Project.idProject,Project.Price 
  ORDER BY addDate DESC
  </code></pre>
  
  <p>*:I wrote that without thinking I was just trying to come up with example extra information, that is meaningless thanks to Hosam Aly.</p>