title: How to get all alphabetic letters in codeigniter from DB? PHP, MySQL, CodeIgniter
body: <p>I'm using this to get all letters to create alphabetic list:
  <code>SELECT DISTINCT SUBSTRING(title, 1, 1) AS letter FROM games ORDER BY letter asc</code>
  Everything OK. But then I try to pass it to codeigniter, it fails (tryed) several variants:</p>
  <pre><code>$this-&gt;db-&gt;distinct();
  $this-&gt;db-&gt;select(&quot;SUBSTRING(title,1,1) AS letter&quot;);
  $this-&gt;db-&gt;order_by(&quot;letter&quot;, &quot;asc&quot;);
  $query = $this-&gt;db-&gt;get('games');
  </code></pre>
  <p>also this one:</p>
  <pre><code>$this-&gt;db-&gt;query(&quot;SELECT DISTINCT SUBSTRING(title,1,1) AS letter ORDER BY letter&quot;);
  $query = $this-&gt;db-&gt;get('games');
  </code></pre>
  <p>All the time I'm getting:</p>
  <blockquote>
  <p>Error Number: 1064</p>
  <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS letter FROM (`games`) ORDER BY `letter` asc' at line 1</p>
  <pre><code>SELECT DISTINCT SUBSTRING(title, `1`, `1)` AS letter FROM (`games`) ORDER BY `letter` asc
  </code></pre>
  <p>Filename: E:\wamp\www\gamecenter\system\database\DB_driver.php</p>
  <p>Line Number: 330</p>
  </blockquote>
  <p>What can I try to resolve this?</p>