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

Home -> Community -> Mailing Lists -> Oracle-L -> sql problem (hope it's not too easy!)

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

From: Dennis Taylor <ismgr_at_pctc.com>
Date: Fri, 22 Dec 2000 07:46:30 -0800
Message-Id: <10718.125245@fatcity.com>


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. Received on Fri Dec 22 2000 - 09:46:30 CST

Original text of this message

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