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

Home -> Community -> Usenet -> c.d.o.server -> Re: Query Help

Re: Query Help

From: Robert Nurse <rnurse_at_cudbytech.net>
Date: 30 Jul 2004 12:25:19 -0700
Message-ID: <a967f5b9.0407301125.7413a3fb@posting.google.com>


gmuldoon <gmuldoon_nospam_at_scu.edu.au> wrote in message news:<MPG.1b746645e3bfbd21989729_at_news.asgard.net.au>...
> "Robert Nurse" <rnurse_at_cudbytech.net> wrote in message
> > I've got a report to do and I need a little help with the query.
> > Here's the table structure
> >
> > rowID PK
> > descriptiveName
> > Col2 FK
> > Col3
> > Col4
> > Col5
> > Col6
> >
> > Col3 through Col6 contain values taken from rowID. Just as a side
> > note, this table is not normalized. Correct? Anyway, when I query
> > the table instead of displaying the data in Col3 through Col6, I'd
> > like to display the corresponding descriptiveName for those values.
> > Could someone give me a hint at a PL/SQL solution for this? I'm new
> > to PL/SQL.
>
> If I've got your questions right, try:
>
> select rowID, descriptiveName, (select descriptiveName from tableName b
> where b.rowId = a.Col2) as "Col2", <..etc...> from tableName a
>
> GM

Basically, I've got a table with the following structure:

rowID NUMERIC (PK)
descName VARCHAR(XXX)
col1 NUMERIC
col2 NUMERIC
col3 NUMERIC
col4 NUMERIC
col5 NUMERIC

.
.
.

col1 through col5 takes values that are in rowID ONLY. I'd like to select rows that display the matching descriptive name for the values in col1 through col5 rather than the numbers:

rowID descName descName_for_col1_value descName_for_col2_value ... Received on Fri Jul 30 2004 - 14:25:19 CDT

Original text of this message

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