Re: How to write this sql urgent...

From: Carlos <miotromailcarlos_at_netscape.net>
Date: Mon, 25 Jan 2010 11:27:57 -0800 (PST)
Message-ID: <9bfcf718-6264-4d9b-943a-92d34a98ada4_at_b10g2000yqa.googlegroups.com>



On Jan 25, 6:34 pm, JIACHENG SUN <sun..._at_googlemail.com> wrote:
> right..
>
> create table AA
> (
>   C_1 VARCHAR2(50) not null,
>   C_2 VARCHAR2(4000) not null,
>   C_3 VARCHAR2(4000),
>   C_4 VARCHAR2(4000)
> );
>
> insert into table aa values (1, code1, null, null);
> insert into table aa values (1, code2, null, null);
> insert into table aa values (2, code3, null, null);
> insert into table aa values (2, code5, null, null);
>
> create table AAA
> (
>   C_1 VARCHAR2(50) not null,
>   C_2 VARCHAR2(4000) not null,
>   C_3 VARCHAR2(4000),
>   C_4 VARCHAR2(4000)
> );
>
> insert into table aa values (code1, 5.5, null, null);
> insert into table aa values (code2, 3.5, null, null);
> insert into table aa values (code3, 0.00, null, null);
> insert into table aa values (code4, 0.00, null, null);
> insert into table aa values (code5, 0.00, null, null);

Please post the REAL code. The one you provided will fail to Insert the values without the single quotes for the VARCHAR2 columns (if they are VARCHAR2, which is not very clear to me).

Besides that, you seem to go after some kind of cross join/cartesian product between 'TABLE 2' and SELECT DISTINCT REF FROM TABLE 1, but I'm with Michel on this one: It would be nice if you could explain the logic of the join that you are trying to accomplish.

Cheers.

Carlos. Received on Mon Jan 25 2010 - 13:27:57 CST

Original text of this message