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 -> newbee question

newbee question

From: P B <pbeliveau_at_avior.ca>
Date: Fri, 23 Jul 2004 11:01:38 -0400
Message-ID: <9j82g0hmh1qlg52i906es37dert29g16dm@4ax.com>


I have 3 tables which are build like this

Table 1:  	P_KEY1
		DATA_1_1

...
Table 2: P_KEY1 (referencing table 1) P_KEY2 DATA_2_1
...
Table 3: P_KEY1 (referencing table 1) P_KEY3 DATA_3_1
...

if I do the following query:

SELECT T1.PKEY1, T2.P_KEY2, T2.DATA_2_1, T3.P_KEY3, T3.DATA_3_1 FROM table_1 T!, table_2 T2, table_3 T3
WHERE T1.P_KEY1=T2.P_KEY1 and T1.P_KEY1=T3.P_KEY3;

I end up with

P_KEY1	P_KEY2	DATA_2_1	P_KEY3   DATA_3_1
key_1		key_2.1		data21.1	key_3.1	  data31.1
key_1		key_2.1		data21.1	key_3.2	  data31.2
key_1		key_2.2		data21.2	key_3.1	  data31.1
key_1		key_2.2		data21.2	key_3.2	  data31.2

because I have multiple row in table 2 and table 3 that fill the condition.

The question:

How do I make my query to end up with

P_KEY1	P_KEY2	DATA_2_1	P_KEY3   DATA_3_1
key_1		key_2.1		data21.1	key_3.1	  data31.1
key_1		key_2.2		data21.2	key_3.2	  data31.2

instead?

Thanks Received on Fri Jul 23 2004 - 10:01:38 CDT

Original text of this message

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