Subject Re: Valid reasons for sorting on a column one doesn't select? - a BUG!
Author plinehan
In firebird-support@yahoogroups.com, "plinehan"
<plinehan@y...> wrote:


Firstly, thanks to all those who gave me
valid reasons why one might want to sort
on a column not present in the select.

However, on one of the Oracle groups, one
thoughtful individual explained to me why allowing
this construct is a bug.


> SELECT DISTINCT(First_Name)
> FROM Employee
> ORDER BY Last_Name


------
Since John can only show up once in the output, is
it at the top of the sorted list (John Andrews),
in the middle (John Meany), or at the end (John
White)?
---------


I had stumbled onto this myself, wondering about
which last name got eliminated in the sort, and
it doesn't appear to be well defined. I think
that Firebird should *_NOT_* allow ORDER BY's on
aggregate functions in this manner.

SELECT DISTINCT(First_Name)
FROM Employee
ORDER BY First_Name

is a valid query, and works in both FB and Oracle.

But allowing an order by on a separate field
in an aggregate simply doesn't make sense.


Where should I report this bug in Firebird?



Paul...