title: Restrict ROW_NUMBER to order non-repeated values
body: <p>How can I rank my data setting different values to each row, but giving the first values of the rank to the distinct rows?</p>
  
  <p>I have emails data and I have to RANK the email as it is valid or not. I already did the validation part, however I'm having a lot of trouble with the ranking process.</p>
  
  <p>This example of data is for one person.</p>
  
  <pre><code>ID     | EMAIL             |
  181818 | example@mail.com  |
  181818 | exam@pe@mail.com  |
  181818 | example@mail.com  |
  181818 |                   |
  181818 | example1@mail.com |
  181818 | examlpe@mail.com  |
  181818 |                   |
  </code></pre>
  
  <p>So, my validation gets me something like this</p>
  
  <pre><code>ID     | EMAIL             | VALID
  181818 | example@mail.com  |  1
  181818 | exam@pe@mail.com  |  0
  181818 | example@mail.com  |  1
  181818 |                   |  0
  181818 | example1@mail.com |  1
  181818 | examlpe@mail.com  |  1
  181818 |                   |  0
  </code></pre>
  
  <p>My code to rank this data is:</p>
  
  <pre><code>SELECT  E.ID,
          UPPER(E.EMAIL),
          ROW_NUMBER()
              OVER (  PARTITION BY E.ID
                      ORDER BY (  CASE
                                    --VALIDATION PROCESS
                                   END) DESC) AS ROWNO
      FROM TABLE E
      WHERE E.ID = 181818 ;
  </code></pre>
  
  <p>This query returns the valid mails first and the invalid last, which is what I want, however I dont want repeated data to appear at top. I would like something like <code>DENSE_RANK</code> but the repeated data to be a at the end in order to avoid equal ranking values.</p>
  
  <p><strong>RETURN:</strong></p>
  
  <pre><code>ID     | EMAIL             | ROWNO
  181818 | example@mail.com  |  1
  181818 | example@mail.com  |  2
  181818 | example1@mail.com |  3
  181818 | examlpe@mail.com  |  4
  181818 | exam@pe@mail.com  |  5
  181818 |                   |  6
  181818 |                   |  7
  </code></pre>
  
  <p><strong>WANTED:</strong></p>
  
  <pre><code>ID     | EMAIL             | ROWNO
  181818 | example@mail.com  |  1
  181818 | example1@mail.com |  2
  181818 | examlpe@mail.com  |  3
  181818 | example@mail.com  |  4
  181818 | exam@pe@mail.com  |  5
  181818 |                   |  6
  181818 |                   |  7
  </code></pre>