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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Function needed

Re: Function needed

From: The Ghost <The_at_Ghost.com>
Date: Sat, 17 Mar 2001 05:14:54 GMT
Message-ID: <ipCs6.57657$p66.17387383@news3.rdc1.on.home.com>

You need a select statement...

select field2_name from a,b
where a.field2=b.field2
and a.field1 in (select field1 from a where field2='&val') and b.field2 !='&val'
/
"Teresa Huntsman" <thuntsma_at_uiuc.edu> wrote in message news:3AB27055.73556BC5_at_uiuc.edu...
> I've seen similar queries to this one posted here but don't remember
> seeing this one, and Google doesn't help...
>
> Dumb example follows.
>
> Here's the first table:
>
> Field1 Field2
> ------ ------
> 1 A
> 1 C
> 1 B
> 1 D
> 2 E
> 2 F
> 2 G
>
> Here's the second table:
>
> Field2 Field2_Name
> ------ -----------
> A A's Name
> B B's Name
> C C's Name
> D D's Name
> E E's Name
> F F's Name
> G G's Name
>
> I need a function on Field2 that will return:
>
> Field2 Return value
> ------ ------------
> A B's Name, C's Name, D's Name
> B A's Name, C's Name, D's Name
> C A's Name, B's Name, D's Name
> D A's Name, B's Name, C's Name
> E F's Name, G's Name
> F E's Name, G's Name
> G E's Name, F's Name
>
Received on Fri Mar 16 2001 - 23:14:54 CST

Original text of this message

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