title: Remove single quotes from where_in in codeigniter
body: <p>I am working on a <code>search</code> functionality.
  I have created a search form in which user can search an Application based on <code>Type</code>,<code>ope</code> &amp; <code>Formate</code>.</p>
  
  <p>I have used a <strong>subquery</strong> in my <strong>join</strong> query to get the desired result. 
  I have tested my query in <code>MySQL Workbench</code> nad it's working fine.</p>
  
  <p>But when I tried that same query in Codeigniter using query builder technique then I am facing a problem.</p>
  
  <p>Here is the query which is worked fine in workbench:</p>
  
  <pre><code>SELECT (*)
  FROM `App`
  LEFT JOIN `App_type` 
  ON `App_type`.`app_id` = `App`.`id`
  LEFT JOIN `App_formate` 
  ON `App_formate`.`app_id` = `App`.`id`
  WHERE `App`.`id` IN(select app_id FROM App_type WHERE type_id in (3,2,6) group by app_id HAVING COUNT(*) = 3)
  AND `App_formate`.`formate_id` IN('1', '3')
  AND `jobs`.`ope_min` &lt;= '3'
  AND `jobs`.`ope_max` &gt;= '3'
  GROUP BY `jobs`.`id`;
  </code></pre>
  
  <p>This is the join query which I use:</p>
  
  <pre><code>$subquery = "select app_id FROM App_type WHERE type_id in ($selected_type) group by app_id HAVING COUNT(*) = $type_count";
  
  $search_app_query = $this-&gt;db
      -&gt;select('*')
      -&gt;from('App')
      -&gt;join('App_type', 'App_type.app_id = App.id', 'left outer')
      -&gt;join('App_formate', 'App_formate.app_id = App.id', 'left outer')      
      -&gt;where_in('App.id',$subquery)  //&lt;-- Here is the problem
      -&gt;where_in('App_formate.formate_id',$data['selected_formates'])
      -&gt;where('App.ope_min &lt;=',$data['ope_value'])
      -&gt;where('App.ope_max &gt;=',$data['ope_value'])    
      -&gt;group_by("App.id", "desc")
      -&gt;get();
  </code></pre>
  
  <p>While I am debugging this problem it shows the </p>
  
  <pre><code> I have found the problem is in this part of the query:
   "WHERE `App`.`id` IN('select app_id 
   FROM App_type 
   WHERE type_id in (3,2,6) 
   group by app_id HAVING COUNT(*) = 3')"
  </code></pre>
  
  <p>that single quote in this subquery is creating a problem.</p>
  
  <p>What I have tried so far:</p>
  
  <p>To remove this single quote I have tried </p>
  
  <ol>
  <li><code>REPLACE($subquery, '''', '')</code> </li>
  <li><code>-&gt;where_in('App.id',trim($subquery,"'"))</code></li>
  <li><code>$subquery_improved = substr($subquery, 1, -1);</code> </li>
  </ol>
  
  <p>But all this solution is not working. They are not removing the single quote.</p>
  
  <p>Note: I am aware of <code>$this-&gt;db-&gt;query()</code> but do not want to use that.</p>