title: MySQL varchar with unique date sorting
body: <p>I have a mysql table that has a build number that is formatted like this</p>
  
  <pre><code>client-yearmonthdayhourminute
  TKSUS-201310210353
  </code></pre>
  
  <p>I want to build a query that will pull me the last 4 days. We may have a multiple runs a day so I would want the latest one for the day.</p>
  
  <pre><code>TKSUS-201310210353
  TKSUS-201310210153
  TKSUS-201310200353
  TKSUS-201310190353
  TKSUS-201310180353
  </code></pre>
  
  <p>I tried something like the following but if there is a multiple runs a day it breaks</p>
  
  <pre><code>SELECT DISTINCT build_number FROM test_case_executions WHERE build_number LIKE 'TKSUS%' AND build_number IS NOT NULL ORDER BY build_number DESC LIMIT 4;
  </code></pre>
  
  <p>Even tried something like this </p>
  
  <pre><code>SELECT DISTINCT SUBSTR(build_number, 7, LENGTH(build_number)-6) FROM test_case_executions WHERE build_number LIKE 'TKSUS%' ORDER BY build_number DESC LIMIT 4;
  </code></pre>
  
  <p>Thanks for any help.</p>