title: Issue in MySQL stored procedure from 5.0 to 5.1
body: <p>When I upgraded from MySQL 5.0 to 5.1, the following SQL statement in an SP stopped working with error code 1064 - invalid column name VARCLNO in WHERE clause:</p>
  
  <pre><code>SELECT *, CLNO as VARCLNO, concat(CLCompany, CLSurname, CLFirstName, CLNO) as CLSort FROM Customer WHERE
   CLEditDate = (select max(CLEditDate) from Customer WHERE VARCLNO = CLNO )
   ORDER BY CLSort;
  </code></pre>
  
  <p>The CUSTOMER table columns all begin CL. </p>
  
  <p>Any help much appreciated.</p>