title: COUNT output rows in a joined query in SQL
body: <p>i've two table :</p>
  
  <pre><code>programmes[id,name,..]
  notes[id,note,id_prgm,..]
  </code></pre>
  
  <p>I actually have a request to know some info about prgm and associated notes :</p>
  
  <pre><code>SELECT p.id, p.name, ...
  FROM programmes p
      LEFT OUTER JOIN notes n
      ON (n.id_prgm=p.id AND ...)
  WHERE ...
  GROUP BY p.id
  ORDER BY ...
  LIMIT 20
  </code></pre>
  
  <p>And it work great, but now I want to know how many row this query can give to me (without the LIMIT)
  So I try to put a COUNT(p.id), but it give me the number of note for each programme. And not the full number of programmes.</p>
  
  <p>So who can i edit this query to know that ? </p>
  
  <p>(mysql with php)</p>