title: #1242 - Subquery returns more than 1 row in mysql
body: <p>I'm new programmer. So I couldn't post images
  I have 2 tables which I want to calculate
  table <code>tarif</code> and <code>airdanlistrik</code></p>
  
  <p>Table <code>tarif</code> has 4 columns:  </p>
  
  <ul>
  <li><code>id_tarif</code>, <code>air</code>, <code>listrik</code>, <code>tanggal</code></li>
  </ul>
  
  <p>Table <code>airdanlistrik</code> has 6 columns:  </p>
  
  <ul>
  <li><code>id_airdanlistrik</code>, <code>id_rumah</code>, <code>posisi_air</code>, <code>posisi_listrik</code>,
  <code>id_maintenance</code>, <code>tanggal</code></li>
  </ul>
  
  <p>I tried following query, but it has an error</p>
  
  <pre><code>select 
    (
      select (d.posisi_air * t.air) as harga 
        from airdanlistrik d, tarif t 
       where t.tanggal = (select max(tanggal) from tarif) 
         and month(d.tanggal) = 1 
         and year(d.tanggal) = year(now())
    ) 
    - 
    (
      select (d.posisi_air * t.air) as harga 
        from airdanlistrik d,tarif t 
       where t.tanggal = (select max(tanggal) from tarif) 
         and month(d.tanggal) = 12 
         and year(d.tanggal) = year(now())-1
    ) 
  from airdanlistrik d, tarif t 
  group by d.id_rumah
  </code></pre>
  
  <p>This is error</p>
  
  <pre><code> #1242 - Subquery returns more than 1 row
  </code></pre>
  
  <p>I don't have enough idea on how to solve this error. please help me. </p>