title: Select distinct rows based on MAX value of a certain column
body: <p>I am retrieving results using Teradata SQL assistant and need help de-duping some data. I only want to return results that have the max VRSN_ID based on PROD_ID. </p>
  
  <p>I tried something like this in the code but did not work as desired:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>FROM( 
   SELECT *, ROW_NUMBER() OVER (
   PARTITION BY PROD_ID 
   ORDER BY  VRSN_ID DESC) AS ROWNUM 
   FROM tblDATA)</code></pre>
  </div>
  </div>
  </p>
  
  <p>Current Result:
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>CMPNY_CD VRSN_ID PROD_ID
  ABC 1 33303115
  ABC 1 33303115
  ABC 1 33303115
  ABC 2 33303115
  ABC 4 32632795
  ABC 2 32632795</code></pre>
  </div>
  </div>
  </p>
  
  <p>Desired Result: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>CMPNY_CD VRSN_ID PROD_ID
  ABC 2 33303115
  ABC 4 32632795</code></pre>
  </div>
  </div>
  </p>