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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Stupid SQL question

Re: Stupid SQL question

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 28 May 1998 19:37:57 GMT
Message-ID: <3571bcb1.26313546@192.86.155.100>


A copy of this was sent to "Marcy A. McKee" <marcy_at_decisionism.com> (if that email address didn't require changing) On Thu, 28 May 1998 12:04:01 -0600, you wrote:

>Hello,
>I have the following query:
>select city || '-NE' from blah where city = 'OMAHA' and state =
>'NEBRASKA'
>that works the way I want it to. My problem is that I want to include an
>additional statement like
>select city || '-IA' from blah where city = 'OMAHA' and state = 'IOWA'
>so that my end result is OMAHA-NE when the state is equal to Nebraska
>and OMAHA-IA when the state is equal to Iowa. Any ideas on how to do
>this?
>
>Thanks,
>Marcy

select city || decode( state, 'NEBRASKA', '-NE',

                              'IOWA',     '-IA', 
                               ...... )
  from blah
 where city = 'OMAHA';  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu May 28 1998 - 14:37:57 CDT

Original text of this message

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