title: Using a table-alias in Kohana queries?
body: <p>I'm trying to run a simple query with <code>$this-&gt;db</code> in Kohana, but am running into some syntax issues when I try to use an alias for a table within my query:</p>
  
  <pre><code>$result = $this-&gt;db
    -&gt;select("ci.chapter_id, ci.book_id, ci.chapter_heading, ci.chapter_number")
    -&gt;from("chapter_info ci")
    -&gt;where(array("ci.chapter_number" =&gt; $chapter, "ci.book_id" =&gt; $book))
    -&gt;get();
  </code></pre>
  
  <p>It seems to me that this should work just fine. I'm stating that "chapter_info" ought to be known as "ci," yet this isn't taking for some reason. The error is pretty straight-forward:</p>
  
  <pre><code>There was an SQL error: Table 'gb_data.chapter_info ci' doesn't exist - 
  SELECT `ci`.`chapter_id`, `ci`.`book_id`, `ci`.`chapter_heading`, 
         `ci`.`chapter_number`
  FROM (`chapter_info ci`) 
  WHERE `ci`.`chapter_number` = 1
    AND `ci`.`book_id` = 1
  </code></pre>
  
  <p>If I use the full table name, rather than an alias, I get the expected results without error. This requires me to write much more verbose queries, which isn't ideal.</p>
  
  <p>Is there some way to use shorter names for tables within Kohana's query-builder?</p>