title: Why does using "where rownum = 1" not select the first ordered row?
body: <p>This is very weird, so I could use a pair of spare eyes to understand what's happening.</p>
  <p>So I have this query:</p>
  <pre class="lang-sql prettyprint-override"><code>WITH x as (
              SELECT num_aula, tipo_aula, min(abs(capienza-1)) score
              FROM aula
              JOIN (
                      select num_aula, tipo_aula
                      from aula
                      where tipo_aula = 'Laboratorio'
                      minus
                      select num_aula, tipo_aula
                      from occr_lezione
                      where to_char(Data_inizio_occr_lezione,'hh24:mi') = '12:30'
                      and Nome_sede = 'Centro Direzionale'
                      and Giorno_lezione = 2
                   )
              USING(num_aula,tipo_aula)
              GROUP BY num_aula, tipo_aula
              ORDER BY score asc
  )
  SELECT *
  FROM x
  </code></pre>
  <p>which return this result set:</p>
  <pre><code>NUM TIPO_AULA                 SCORE
  --- -------------------- ----------
  1   Laboratorio                  35
  2   Laboratorio                  35
  </code></pre>
  <p>Which is the desired result.</p>
  <p>Now, if I add this line to the query:</p>
  <pre><code>WHERE rownum = 1;
  </code></pre>
  <p>which should return the first row of the table, I get this:</p>
  <pre><code>NUM TIPO_AULA                 SCORE
  --- -------------------- ----------
  2   Laboratorio                  35
  </code></pre>
  <p>How is that possible?</p>