title: MySQL SELECT unique column where other column is max
body: <p>I have table like this</p>
  
  <pre><code>  id     |     serial_num     |      version     | .....
    1      |         1          |          1       | .....
    2      |         2          |          1       | .....
    3      |         2          |          2       | .....
    4      |         3          |          1       | .....
    5      |         4          |          1       | .....
    6      |         5          |          1       | .....
    7      |         5          |          2       | .....
    8      |         5          |          3       | .....
  </code></pre>
  
  <p>Now what I want to select is to get rows with max version and unique serialn_num ... </p>
  
  <p>The result would be:</p>
  
  <pre><code>  id     |     serial_num     |      version     | .....
    1      |         1          |          1       | .....
    3      |         2          |          2       | .....
    4      |         3          |          1       | .....
    5      |         4          |          1       | .....
    8      |         5          |          3       | .....
  </code></pre>
  
  <p>My SQL is a bit more complicated and that is why I don't solve the problem by using MAX()... I have few left joins etc ...</p>
  
  <p>any ideas?</p>
  
  <p>Best regards and thank you for your time!</p>