Re: SQL-- Please help me :)

From: Mark D Powell <Mark.Powell2_at_hp.com>
Date: Mon, 25 Jan 2010 12:11:26 -0800 (PST)
Message-ID: <e8d47a65-13f9-4153-bebf-989a270df6da_at_a6g2000yqm.googlegroups.com>



On Jan 25, 9:49 am, JIACHENG SUN <sun..._at_googlemail.com> wrote:
> table 1
> ref     code
> 1       code_1
> 1       code_2
> 2       code_3
> 2       code_5
> .......
> .......
>
> table 2
> code      code_description    value
> code_1    description1         3.4
> code_2    description2         3.5
> code_3    description3         0
> code_4    description4         0
> code_5    description5         0
>
> how to write a sql to get the result below:
>
> ref    code       description      value
> 1      code_1    description1       3.4
> 1      code_2    description2       3.5
> 1      code_3    description3       0
> 1      code_4    description4       0
> 1      code_5    description5       0
> 2      code_1    description1       3.4
> 2      code_2    description2       3.5
> 2      code_3    description3       0
> 2      code_4    description4       0
> 2      code_5    description5       0
> ...........
> ............
>
> I tried to use outer join and nvl function, but still couldn't get the
> result i need. Cos if we have 1000 refs in table 1,  it is impossible
> to use nvl. how do your guys think?
>
> thanks so much!!

Please do not cross-post. This thread is also posted to the server forum where a potential answer has been posted. Received on Mon Jan 25 2010 - 14:11:26 CST

Original text of this message