title: CodeIgniter multiple database query
body: <p>I tried to run query on multiple database with following sql query:</p>
  
  <pre><code>// Collect clients db name
  $dbs = array();
  foreach($cafes as $cafe)
  {
      $dbs[] = $cafe-&gt;db_name; // client_7
  }
  
  // Run multi database query
  foreach($dbs as $db)
  {
      $this-&gt;db-&gt;select("$db.orders.*,(select count($db.order_items.id) from $db.order_items where $db.order_items.siparis_id = orders.id) as urun_sayisi, (select sum($db.order_items.tutari) from $db.order_items where $db.order_items.siparis_id = orders.id) as price");
  }
  
  $this-&gt;db-&gt;get()-&gt;result();
  </code></pre>
  
  <p>In above example, i have cafe clients and each client have own db named ex: client_7. I am trying to do list all client orders. I got following error with above query:</p>
  
  <blockquote>
    <p>Unknown table 'client_7' in field list</p>
  </blockquote>
  
  <p>How can list all rows on orders table from multiple database?</p>