title: MySQL LIKE with range doesn't work
body: <p>I've got a database table <em>mytable</em> with a column <em>name</em> in Varchar format, and column <em>date</em> with Datetime values. I'd like to count names with certain parameters grouped by date. Here is what I do:</p>
  
  <pre><code>SELECT
      CAST(t.date AS DATE) AS 'date',
      COUNT(*) AS total,
      SUM(LENGTH(LTRIM(RTRIM(t.name))) &gt; 4 
          AND (LOWER(t.name) LIKE '%[a-z]%')) AS 'n'
  FROM
      mytable t
  GROUP BY 
      CAST(t.date AS DATE)
  </code></pre>
  
  <p>It seems that there's something wrong with range syntax here, if I just do <code>LIKE 'a%'</code> it does count properly all the fields starting with 'a'. However, the query above returns 0 for n, although should count all the fields containing at least one letter.</p>