Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL QUERY HELP

Re: SQL QUERY HELP

From: Allan Davis Sahadeo <asahadeo_at_neal-and-massy.com>
Date: Thu, 05 Apr 2001 11:14:28 -0700
Message-ID: <F001.002E3066.20010405111152@fatcity.com>

Try this.

select empcode, empname, sal,
decode(to_char(trunc((nvl(sal,0)+1)/5001)),'0','A','B') NewCol from emp
/

> Hi Gurus
> I have following data in table emp
> empcode empname SAL
> a001 XXXXX 2000
> b001 YYYYY 4000
> c001 AAAAA 5000
> d001 CCCCC 8000
> If sal is >=5000 there will be another columns grade and print A else B
> The outout would be like
> empcode empname SAL Grade
> a001 XXXXX 2000 B
> b001 YYYYY 4000 B
> c001 AAAAA 5000 A
> d001 CCCCC 8000 A
> Please help how can i write such query.
> Thanks
> -Seema
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Seema Singh
> INET: oracledbam_at_hotmail.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Allan Davis Sahadeo
  INET: asahadeo_at_neal-and-massy.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Apr 05 2001 - 13:14:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US