title: Syntax error in sql SQL Status:42601
body: <p>I want to list the id of the most common type of post history in 2013. </p>
  
  <p>My code for just counting the numbers of how often each type comes up is correct:</p>
  
  <pre><code>SELECT  COUNT(id)  FROM post_history WHERE year = 2013 GROUP BY post_history_type_id ORDER BY COUNT(id)
  </code></pre>
  
  <p>Now I want to extract the maximum and just show the id of it. I tried it that way:</p>
  
  <pre><code>SELECT MAX(SELECT  COUNT(id)  FROM post_history WHERE year = 2013 GROUP BY post_history_type_id ORDER BY COUNT(id);) FROM post_history ;
  </code></pre>
  
  <p>But he says following error:</p>
  
  <blockquote>
    <p>FEHLER:  Syntaxerror at „SELECT“ LINE 7: SELECT MAX(SELECT  COUNT(id) 
    FROM post_history WHERE year =...
                       ^</p>
    
    <p>********** Error**********</p>
    
    <p>ERROR: Syntaxerror at „SELECT“ SQL Status:42601 Zeichen:255</p>
  </blockquote>
  
  <p>Hope you can help me :)</p>