title: How to combine table and aggregated results in SQL
body: <p>I have a table of indicators (e.g. number of students) for schools in a number of districts.</p>
  
  <p>I need to aggregate those indicators by districts, and I would like to collate those aggregates at the bottom of my initial table:</p>
  
  <p>I have :</p>
  
  <pre><code>district    school  students
  District1   School1 10
  District2   School2 20
  District1   School3 30
  District2   School4 40
  District1   School5 50
  District2   School6 60
  </code></pre>
  
  <p>I would like to eventually get in the same table:</p>
  
  <pre><code>district    school  students
  District1   School1 10
  District2   School2 20
  District1   School3 30
  District2   School4 40
  District1   School5 50
  District2   School6 60
  District1   Total   90
  District2   Total   120
  </code></pre>
  
  <p>I have tried </p>
  
  <pre><code>SELECT district, school, students
  FROM enrolment
  UNION 
  SELECT district, "Total" as school, sum(students)
  FROM enrolment
  GROUP BY district;
  </code></pre>
  
  <p>but I'm actually pulling many indicators from many different queries, and aggregating on two additional levels (states and country), so it's very slow. Is there a most efficient way of doing this?</p>