Data Sorting without using that column in select list

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Enthusiast

Data Sorting without using that column in select list

Hi All,

 

I have requirement like , i need to select the data from table and display it in ascending order of particular column  but my select list should not have that column which i whould  like to sort it

 

Could any one please help on this.

 

Eg

The table has the data like this

 

Input   
    
 S_NoCountryState
 4USAlaska
 5USCalifornia
 6ChinaShandong
 7ChinaSichuan
 1IndiaDelhi
 2IndiaChennai
 3IndiaMumbai
    
Output   
 CountryState 
 IndiaDelhi 
 IndiaChennai 
 IndiaMumbai 
 USAlaska 
 USCalifornia 
 ChinaShandong 
 ChinaSichuan

 

 

 

Thanks

Vinoth.B

Tags (1)

Accepted Solutions
Highlighted
Senior Apprentice

Re: Data Sorting without using that column in select list

Not a problem.

 

Your ORDER BY just names the column(s) that you use for sorting. They do not have to be in the SELECT list.

 

So something like: ORDER BY S_NO

 

HTH

Dave

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com
1 ACCEPTED SOLUTION
2 REPLIES
Highlighted
Senior Apprentice

Re: Data Sorting without using that column in select list

Not a problem.

 

Your ORDER BY just names the column(s) that you use for sorting. They do not have to be in the SELECT list.

 

So something like: ORDER BY S_NO

 

HTH

Dave

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com
Enthusiast

Re: Data Sorting without using that column in select list

Thanks DaveWellman