title: Mysql COUNT(*) on multiple tables
body: <p>What's wrong with this query:</p>
  
  <pre><code>SELECT co.*, mod.COUNT(*) as moduleCount, vid.COUNT(*) as vidCount 
   FROM courses as co, modules as mod, videos as vid 
   WHERE mod.course_id=co.id AND vid.course_id=co.id ORDER BY co.id DESC
  </code></pre>
  
  <p>In other words, how can I do it so with every record returned from 'courses', there's 
  an additional column called 'modCount' which shows the number of records in the modules table for that course_id, and another called 'vidCount' which does the same thing for the videos table.</p>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Error Number: 1064</p>
    
    <p>You have an error in your SQL syntax;
    check the manual that corresponds to
    your MySQL server version for the
    right syntax to use near '<em>) as
    moduleCount, vid.COUNT(</em>) as vidCount
    FROM courses as co, ' at line 1</p>
  </blockquote>