Home » RDBMS Server » Server Administration » Order by
Order by [message #373647] Sun, 29 April 2001 20:37 Go to next message
Arjun V
Messages: 14
Registered: March 2001
Junior Member
I hv a column with say the following values

rat
cat
fat
mat

I want to order the values, but i want the 'fat' to be on the top of the list..and rest of the values after that in the order by manner.

fat
cat
mat
rat

How can i do that. Please help
Thanks in advance.
Arjun V
Re: Order by [message #373652 is a reply to message #373647] Mon, 30 April 2001 09:41 Go to previous messageGo to next message
John R
Messages: 156
Registered: March 2000
Senior Member
If we assume that your table is called TEMP and has a column called TEXT, containing the data you mentioned, then this will work

select TEXT
from TEMP
order by decode(TEXT,'Fat',1,2),TEXT
Re: Order by [message #373656 is a reply to message #373647] Mon, 30 April 2001 10:57 Go to previous messageGo to next message
Krishnan
Messages: 18
Registered: October 2000
Junior Member
select col1, decoe(col1,'fat',' ',col1)
from tab1
order by 2
Re: Order by [message #373741 is a reply to message #373647] Thu, 03 May 2001 16:29 Go to previous message
Sundar Venkatasubramaniam
Messages: 26
Registered: May 2001
Junior Member
try
select col1 from t1 order by decode(col1,'fat',chr(0),col1)
Previous Topic: Help!
Next Topic: ROWID Error?
Goto Forum:
  


Current Time: Sat Jun 29 00:03:01 CDT 2024