title: Subquery More Than One Row
body: <p>i got a problem with my query. I will give my table data, i have 4 tabel: tutor, absen_user, absen, aktivitas</p>
  
  <p>table tutor</p>
  
  <pre><code>| id_tutor | nama   | 
  | 1        | budi   |
  | 2        | Gerald |
  </code></pre>
  
  <p>table absen_user #this table as a bridge of various types of user tables</p>
  
  <pre><code>| id_absen_user | id_anak_or_tutor | type  |
  | 1             | 1                | tutor |
  | 2             | 2                | tutor |
  | 3             | 3                | child |
  </code></pre>
  
  <p>table absen</p>
  
  <pre><code>| id_absen    | id_aktivitas | id_absen_user | absen |
  | 1           | 1            | 1             | Hadir |
  | 2           | 2            | 1             | Hadir | 
  | 3           | 3            | 1             | No    |
  | 4           | 4            | 1             | Hadir |
  | 5           | 1            | 2             | no    | 
  | 6           | 2            | 2             | No    |
  | 7           | 3            | 2             | Hadir |
  | 8           | 4            | 2             | no    |
  </code></pre>
  
  <p>table aktivitas</p>
  
  <pre><code>| id_aktivitas | tanggal    |     
  | 1            | 2018-02-19 |
  | 2            | 2018-02-20 |
  | 3            | 2018-02-21 |
  | 4            | 2018-03-01 |
  </code></pre>
  
  <p>then the result I want</p>
  
  <pre><code>| nama    | Februari |
  | budi    | 67       |
  | gerald  | 33       |
  </code></pre>
  
  <p>data in februari comes from the 'count(absen) with codition field 'Hadir' / count(absen) * 100' ... and this is my query </p>
  
  <pre><code>SELECT nama,
         ifnull((
              SELECT ROUND(SUM(CASE absen
                              WHEN 'Hadir'
                                  THEN 1
                              ELSE 0
                              END) / COUNT(absen) * 100)
              FROM (tutor)
              JOIN absen_user ON absen_user.id_anak_or_tutor = tutor.id_tutor
              JOIN absen ON absen.id_absen_user = absen_user.id_absen_user
              JOIN aktivitas ON aktivitas.id_aktivitas = absen.id_aktivitas
              WHERE (
                      (Month(aktivitas.tanggal) = 2)
                      AND (YEAR(aktivitas.tanggal) = 2018)
                      )
              GROUP BY tutor.nama
              ), 0) AS `Februari`
  FROM tutor
  </code></pre>
  
  <p>and the error i get <code>subquery return more than 1 row</code></p>