title: Write Subqueries in Code Igniter
body: <p>Hello everyone i need a help for writing subqueries on Code Igniter i always fail if i'm using db active record.</p>
  
  <p>Queries that i want to run is </p>
  
  <pre><code>select ( alias_a.field_a + alias_b.field_b ) as total_a from
  ( select sum(field_a) as TOTAL_SUM, status, date from table_a
  where status ='ok'
  group by year(date)) as alias_a ,
  
  (select sum(field_b) as total_b, status, date from
  table_b where
  status = 'good' group by year(date)) as alias_b
  
  where year(alias_a.date) = year(alias_b.date)
  </code></pre>
  
  <p>this queries has run on sql editor</p>
  
  <p>i have tried <code>$this-&gt;db-&gt;query('my query')</code> but it has error</p>
  
  <p>any info will helping me so much.
  Thanks ! :)</p>