Subject RE: [firebird-support] Valid reasons for sorting on a column one doesn't select?
Author Rick Debay
I import large numbers of Purchase Order responses in a batch, and have to match them up with what inventory is being replenished. I don't care when the order was placed, but I need to do the matching starting with the oldest in the batch, and the same with the transaction that reduced inventory.
If I was using Oracle, I guess I would have to include the timestamp in the query and ignore it.

Rick DeBay

-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of plinehan
Sent: Saturday, August 13, 2005 12:41 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Valid reasons for sorting on a column one doesn't select?



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