title: SQL Server query issues with GROUP BY
body: <p>I have to write a query regarding the statement below:</p>
  
  <blockquote>
    <p>List all directors who directed 50 movies or more, in descending order of the number of movies they directed. Return the directors' names and the number of movies each of them directed.  </p>
  </blockquote>
  
  <p>I have written multiple variations but I keep getting errors. </p>
  
  <p>It involves joins. The tables involved are: </p>
  
  <ul>
  <li><code>Directors</code> (directorID, firstname, lastname), </li>
  <li><code>Movie_Directors</code> (directorID, movieID). </li>
  </ul>
  
  <p>What I have tried so far is:</p>
  
  <pre><code>SELECT DISTINCT 
      firstname, lastname,
      COUNT(movie_directors.directorID)
  FROM 
      dbo.movie_directors
  INNER JOIN 
      directors ON directors.directorID = movie_directors.directorID
  GROUP BY
      firstname, lastname
  HAVING 
      COUNT(movie_directors.directorID) &gt;= 50
  </code></pre>
  
  <p>Is this correct?</p>