Re: Decode based on two fields
Date: 1998/08/13
Message-ID: <35d353c4.115952150_at_dcsun4.us.oracle.com>#1/1
On Thu, 13 Aug 1998 19:38:25 GMT, jybarb01!_at_homer.louisville.edu (Jay Barbee) wrote:
>Hello all,
>
>I wanted to write a simple decode statement from a program. Basically
>I have a list of school codes which I simply want to narrow down the
>the 14 major colleges in the university. However, I have one entry
>that could belong to 1 of two schools based on the major of the
>student.
>
>SchoolCode = SS if (SchoolCode = GR AND Major = CS)
>OR
>SchoolCode = BU if (SchoolCode = GR AND Major = MBA OR BA)
>
>As you can see SS and BU are major colleges in the university. GR
>(Graduate School) is more or less a misc division, and the MAJOR field
>is the determining factor (CS -> SS) or (MBA,BA -> BU).
try...
select decode( SchoolCode,
'GR', decode( Major , 'CS', 'SS', 'MBA', 'BU', 'BA', 'BU'))from T;
>Is there anyway to decode a field based on two other fields?
>
>Thanks,
>--Jay Barbee
>jybarb01!_at_homer.louisville.edu
>[NOTE: Remove '!' for valid email address]
>Jay Barbee
>jybarb01!_at_homer.louisville.edu
>[ANTISPAM, remove "!" from address above...]
Received on Thu Aug 13 1998 - 00:00:00 CEST