title: MYSQL - Sort by first letter
body: <p>i have this sql query (below) and it works great but i need to modify it to select only records with $a first character. I've tried a few variations of the LIKE A% with no luck. The crux of my situation seems to be the name alias. If i use WHERE name LIKE 'A%' before the ORDER i get an error. That seems like the logical place for it to be. Any suggestions?</p>
  
  <pre><code>SELECT  
    IF(company_name &lt;&gt; '', company_name, PC_last_name) AS name, 
    customer_id AS id, 
    company_name AS cn, 
    PC_first_name AS pcf, 
    PC_last_name AS pcl, 
    primary_phone 
  FROM sales_customer 
  ORDER BY name
  </code></pre>