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 problem (hope it's not too easy!)

Re: sql problem (hope it's not too easy!)

From: djordjej <djordjej_at_home.com>
Date: Fri, 22 Dec 2000 11:40:18 -0500
Message-Id: <10718.125253@fatcity.com>


Would an outer joing work ? Something like:

select t2.custno

          , t2.feecd
          , t1.feedesc
          , decode(t1.feedesc, null, 'YourDefault',null)
  from t1, t2
 where t2.feecd = t1.feecode (+)

> Because if it is, I'll feel foolish.
>
> I've been struggling with this one for a bit, and if there's an answer,
> it's escaped me.
>
> Given the following (very simplified) tables:
>
> T1:
>
> FEECODE varchar2(10)
> FEEDESC varchar2(50)
>
> constraint T1_PK primary key (FEECODE)
>
>
> T2:
>
> CUSTNO number(9)
> FEECD varchar2(10) (references T1.FEECODE)
> YESNO number(1)
>
> constraint T2_PK primary key (CUSTNO,FEECD)
>
> For any CUSTNO, FEECD is a value which is *always* found in T1 (FEECODE).
> However, for any CUSTNO, all FEECODE's don't necessarily exist in T2. I'd
> like to be able to get an sql output, for any given CUSTNO, showing
CUSTNO,
> FEECODE/FEECD (all possible) ,DESC,YESNO where YESNO is either null or
some
> default if there isn't an occurrence of CUSTNO+FEECODE in T2.
>
> So far, everything I've tried results in a list with just the T2 items
that
> actually exist. I'd like to avoid some monstrous PL/SQL concoction. Is
this
> possible? (I'm sure it is, and it'll be embarrassingly easy).
>
> ---
> Dennis Taylor
> ---
> Don't worry about people stealing your ideas. If your ideas
> are any good,
> you'll have to ram them down people's throats.
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Dennis Taylor
> INET: ismgr_at_pctc.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 Fri Dec 22 2000 - 10:40:18 CST

Original text of this message

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