Home » SQL & PL/SQL » SQL & PL/SQL » To fetch record using DECODE
To fetch record using DECODE [message #273372] Wed, 10 October 2007 03:17 Go to next message
admurthi
Messages: 7
Registered: September 2007
Junior Member

hi all,

I was trying to find a query using Decode..

In an EMP table i would like to catgerise person who get sal < 800 as helper, and sal >1000 and <2000 as executive and sal more than 5000 as manager..


i tried this query

SELECT ename, DECODE(sal,(800),'helper','others') FROM EMP a;
In this query i cld not specify sal>800 or less than 1000

Tanks in adv.
Bye
Re: To fetch record using DECODE [message #273373 is a reply to message #273372] Wed, 10 October 2007 03:19 Go to previous message
Frank
Messages: 7901
Registered: March 2000
Senior Member
If you insist on using decode, you have to use SIGN. Try to find out yourself how you can use this.
Another option is to use CASE instead of DECODE
Previous Topic: Get the maximum value per row
Next Topic: Select where show information from two row in one row
Goto Forum:
  


Current Time: Fri Dec 13 00:50:40 CST 2024