Subject Re: [firebird-support] Valid reasons for sorting on a column one doesn't select?
Author David Johnson
You might add that DB2 supports it, unlike that toy database
Oracle. :o)

Order by is used to sequence data. If you only need the information for
sequencing inside the DBMS, but not for other action, why waste the wire
bandwidth?

I have exactly this situation myself in one data migration package. I
need to order by a column descending in order to generate the correct
sequence for the new target database, which has the rows in the reverse
order. I don't need the old sequence number at all, but I do need the
sort order.

On Sat, 2005-08-13 at 16:40 +0000, plinehan wrote:
>
> This works in FB
>
> SELECT DISTINCT(First_Name)
> FROM Employee
> ORDER BY Last_Name
>
> but this doesn't in Oracle
>
>
> SELECT DISTINCT(Ename)
> FROM Emp
> ORDER BY Sal
>
> ------------------
> with the error
> ERROR at line 3:
> ORA-01791: not a SELECTed expression
> ------------------
>
>
> I thought that I was missing something extremely
> simple in Oracle, so I posted the info there, only
> to be told that
>
> --------------------------
> It is pretty useless to order on sal when
> you don't display the sal. Oracle agrees with me.
> Oracle != Sqlserver and whatever toy products are
> available .
> -----------------------------
>
>
> Can anyone give me a few valid reasons why
> one might want to sort on a field that
> one doesn't select?
>
>
> Paul...
>
>
>
>
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>