title: Need help on using COUNT and SUM together in MySQL
body: <p>I have got 2 tables: Institute &amp; Course</p>
  
  <pre><code>Institute
  ---------
  i_id       i_name      i_city
  ------     --------    --------
  1          Name 1      London
  2          Name 2      Manchester
  3          Name 3      London
  
  Course
  -------
  c_id       i_id        stream
  ------     -------     --------
  1          1           Engineering
  2          1           Engineering
  3          2           Engineering
  4          3           Engineering
  </code></pre>
  
  <p>Now I am trying to achieve 3 things:</p>
  
  <p>a) Number of Institutes per city offering Engineering courses.
  b) Total (distinct) Number of Institutes offering Engineering courses.</p>
  
  <p>I started writing below query to achieve this:</p>
  
  <pre><code>SELECT institute.i_city, 
  COUNT( DISTINCT institute.i_id ) AS institute_count_per_city
  FROM institute, course
  WHERE institute.i_id = course.i_id
  AND course.stream =  'Engineering'
  GROUP BY institute.i_city
  </code></pre>
  
  <p>I got below result:</p>
  
  <pre><code>i_city      institute_count_per_city
  -------     -------------------------
  London      2
  Manchester  1
  </code></pre>
  
  <p>Now I have achieved the count of institutes per city. </p>
  
  <p>I can't figure how can I get the total number of institutes in same query which in the above example will be 3 (2+1)</p>
  
  <p>I would really appreciate the help.</p>