title: MySQL GROUP BY on a float field
body: <p>I have a table that contains the following columns:</p>
  
  <pre><code>ID int, DISTANCE float, EVENT Varchar
  </code></pre>
  
  <p>What i would like to acheive is to select all the data, but to group by the event and distance fields (i.e. to remove duplicate events at the same distance).</p>
  
  <p>The issue I can see is that the <code>Distance</code> column is a float, and as such the <code>GROUP BY</code> may not behave expectantly. Most (i say most) of the data is stored to 3 decimal places, and this is the criteria I would like to group on. </p>
  
  <p>Example Data:</p>
  
  <p>ID,Distance,Event</p>
  
  <pre><code>1, 0.001, A
  2, 0.002, A
  3, 0.002, A
  4, 0.002, B
  5, 0.003, C
  6, 0.0035,C
  </code></pre>
  
  <p>So the result would look like:</p>
  
  <pre><code>1, 0.001, A
  2, 0.002, A
  4, 0.002, B
  5, 0.003, C
  </code></pre>