title: How to select rows by max value from another column in Oracle
body: <p>I have two datasets in Oracle <code>Table1</code> and <code>Table2</code>.
  When I run this:</p>
  <pre><code>SELECT A.ID, B.NUM_X
  FROM TABLE1 A
  LEFT JOIN TABLE2 B ON A.ID=B.ID
  WHERE B.BOOK = 1
  </code></pre>
  <p>It returns this.</p>
  <pre><code>ID        NUM_X
  1          10
  1           5
  1           9
  2           2
  2           1
  3           20
  3           11
  </code></pre>
  <p>What I want are the <code>DISTINCT ID</code> where <code>NUM_X</code> is the <code>MAX</code> value, something like this:</p>
  <pre><code>ID          NUM_x
  1            10
  2             2
  3            20
  </code></pre>