title: Getting max value from rows and joining to another table with join
body: <p>Need help to get query for below output</p>
  
  <p>Table A:</p>
  
  <pre><code>ID  Rank AName
  1   1    Name1
  2   1    Name2
  2   2    Name2.1
  3   1    Name3
  3   2    Name3.2
  3   3    Name3.3
  </code></pre>
  
  <p>Table B:</p>
  
  <pre><code>ID BName
  1  fn1
  2  fn2
  3  fn3
  </code></pre>
  
  <p>What I want is </p>
  
  <pre><code>ID  Rank AName   Bname
  1   1    Name1   fn1
  2   2    Name2.1 fn2
  3   3    Name3.3 fn3
  </code></pre>
  
  <p>Please suggest.
  max rank for each id and name from second table. </p>