Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Thu, 06 Jan 2005 @ 11:27:51 GMT

  <Prev Next>  
Next> Last>>  

Subj:   Order by clause
From:   Agarwal, Rachana

Hi All,

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.

Example :-

     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,


  <Prev Next>  
Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023