Re: How to write this sql urgent...

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Mon, 25 Jan 2010 17:19:30 +0100
Message-ID: <4b5dc48f$0$28655$426a74cc_at_news.free.fr>


"JIACHENG SUN" <sunjcb_at_googlemail.com> a écrit dans le message de news: e39f5472-8f26-47c8-9366-8a5e7fb010cb_at_21g2000yqj.googlegroups.com... On Jan 25, 4:04 pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> "JIACHENG SUN" <sun..._at_googlemail.com> a crit dans le message de news:
> c56a0f25-dc7d-4325-9bc4-3415e35b9..._at_a32g2000yqm.googlegroups.com...
> | 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
> | ...........
> | ............
> |
> | thanks so much!!

>

> And the rule to generate the output is?
>

> Also provide a test case: create table and insert statements.
>

> Regards
> Michel

Hi,

thanks for your reply.

The result i want is:
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

.....

thanks!


> And the rule to generate the output is?

>

> Also provide a test case: create table and insert statements.
>

> Regards
> Michel
Received on Mon Jan 25 2010 - 10:19:30 CST

Original text of this message