title: Amazon Redshift rank group
body: <p>I'm trying to do a ranking on the 1st 10, and then group the remaining in groups of 1000 (based on volume)</p>
  
  <p>Below is the desired results, whats the easiest way to do this?</p>
  
  <p>desired results</p>
  
  <p><img src="https://i.stack.imgur.com/2jZlf.jpg" alt="desired results"></p>
  
  <p>I can get the ranking on volume all the way down using the following, but would like to group anything more than a ranking of 10</p>
  
  <pre><code>DENSE_RANK() over (PARTITION BY date ORDER BY count (DISTINCT volume_key)  DESC)as rnk_loc_Vol 
  </code></pre>