Archives of the TeradataForum
Message Posted: Thu, 06 Jan 2005 @ 11:27:51 GMT
Just a thought on my question....
If an expression is given in the order by clause, it will be treated as the values for all rows and sorting will be done on the evaluated value.
Therefore if we say , order by 1+2 it takes constant value 3 for each row and then sorts on this value.
If we have a reference to a column in the expression, we can see proper sorting .
Whereas when we say order by 3.. It sorts on 3rd column.
select * from t1 Order by substring(name,6,2) ----- Returns expected results. select * from t1 order by 2+1 --------------- assumes all rows to have value 3 and sorts on that basis.
It is just my thought.
Any thoughts on this.
Thanks and Regards,
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|