title: Codeigniter where in and replace Subquery
body: <p>How do I write in codeigniter in active record the following query?</p>
  
  <pre><code>SELECT
    time AS date,
    user AS name
  FROM b_table
  WHERE id IN(SELECT
            a
          FROM a_table
          WHERE group = $group
          AND tag &gt;= '$date1'
          AND tag &lt;= $date2')
  </code></pre>
  
  <p>This is what I come out with but it does not do the job.</p>
  
  <pre><code>$this-&gt;db-&gt;select('a');
  $this-&gt;db-&gt;from('a_table');
  $this-&gt;db-&gt;where('group',$group);
  $this-&gt;db-&gt;where('tag&gt;=',$date1);
  $this-&gt;db-&gt;where('tag&lt;=',$date2);
  
  $subQuery = $this-&gt;db-&gt;_compile_select();
  $this-&gt;db-&gt;_reset_select();
  
  $this-&gt;db-&gt;select('time AS date, user AS name');
  $this-&gt;db-&gt;from('b_table');
  $this-&gt;db-&gt;where_in($subQuery);
  </code></pre>
  
  <p>my problem is (a) from select one is record which need to be replace like replace space to be comma or maybe I'm wrong :(,<br>
  another I use str_replace but still wrong,</p>
  
  <blockquote>
    <blockquote>
      <p>sample data
       a from select one is <br>
      222,111,444<br>
       333,444
      <br><br>
         555,666<br>
      replace with 222,111,444,333,444,555,666<br></p>
    </blockquote>
  </blockquote>
  
  <p>even I'm new in codeigniter
  Appreciate any helps and sorry for my english. <br>
  Thanks.</p>