title: Geting only the max value
body: <p>The folowing code :</p>
  
  <pre><code>SELECT DISTINCT Id1, A1.Id2
  FROM    Table A1 
  WHERE   1 &lt;=
          (SELECT COUNT (*)
          FROM    Table A2
          WHERE   A1.Id2 = A2.Id2)
  </code></pre>
  
  <p>outputs :</p>
  
  <pre><code>                  ID1       ID2
  -------------------- ----------
                     1          1
                     1          2
                     2          3
                     3          4
                     5          6
                     5          7
  </code></pre>
  
  <p>but I want to get the only one ID1 with the maximum value of ID2
  like this :</p>
  
  <pre><code>                  ID1       ID2
  -------------------- ----------
                     1          2
                     2          3
                     5          7
  </code></pre>
  
  <p>what do I do wrong ?</p>