title: Using CAST() with MAX()/MIN()
body: <p>I have some street numbers stored as VARCHARs but I want to sort them where possible as INTs.  This syntax is accepted but produces alpha sorted sets like max = 53, min = 1203</p>
  
  <pre><code>SELECT  `StreetName`, 
  CAST( MIN( `StreetNumber` ) AS UNSIGNED)  as min,
  CAST( MAX( `StreetNumber` ) AS UNSIGNED)  as max
  FROM  `tblAddToLotBridge` 
  WHERE  `LotNumber` = '$item_lotnum'
  AND `Primary_Secondary` = 0 
  GROUP BY `StreetName`
  ORDER BY `StreetName`
  </code></pre>
  
  <p>I tried nesting <code>CAST()</code> inside of <code>MIN()</code>/<code>MAX()</code> but that syntax got rejected.</p>
  
  <p>What is the correct sytax to DWIM?</p>