Dr Gerard Hammond wrote:
(2)  If an ORDER BY term is a simple identifer
     (like "x", not "x.y" and not "x.y.z") and if
     there if the k-th column uses that same identifer
     as an AS alias, the sort by the k-th column.

CREATE TABLE a(x,y);
 INSERT INTO a VALUES(1,8);
 INSERT INTO a VALUES(9,2);

 SELECT x AS y FROM a ORDER BY y;



I don't understand. If I say "ORDER BY y" aren't I saying sort the result set based on the column " as y" of the result set, not the table "a.y"?
ie they should come out

y
9
1


Your description is correct, but your output is in the wrong order. The default sort order is ascending so the 9 will sort after the 1.

Y
1
9

Dennis Cote

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to