SQL -
Posted in 1999
Topics: SQL Development & Query Writing
If I'm getting you right ( excuse me if I'm not ) SELECT t1.A, t1.B, t1.C, t1.D, t2.e, t2.f FROM table1 t1, table2 t2 WHERE ( t1.B = t2.B and t1.D = t2.D ) INTO TEMP t_table1_table2 WITH NO LOG; Obvioulsy use just the select part to do an unload or whatever to check it works. Then incorporate it into an INSERT or use it to create a temporary table etc. HTH.
Hi All, I've got table 1 with 4 articles A, B, C, D and i've got a second table 2 with articles B, D, E, F, and I want to create a third (temp)table 3 with the articles from table 1 & 2, from A throw F. How do I manage that? I've tried a lot with temp tables, joins and outer joins but i just can't find out! Greetings Alex
A. Bernaards <Xpiet@bruynzeel.com> schrieb in im Newsbeitrag: 3861fbba$0$16694@news2.zeelandnet.nl...
> Hi All,
>
> I've got table 1 with 4 articles A, B, C, D
> and i've got a second table 2 with articles B, D, E, F,
> and I want to create a third (temp)table 3 with the articles from table 1 &
> 2, from A throw F.
>
> How do I manage that?
What about union:
select articles from table_1
union
select articles from table_2
into temp table_3
The selected structure of the rows in table_1 and table_2 have to be
identically. Union eliminates all double rows.
Don´t use union all in this case.
HTH
Reinhard
In article <3861fbba$0$16694@news2.zeelandnet.nl>,
A. Bernaards <Xpiet@bruynzeel.com> wrote:
>Hi All,
>
>I've got table 1 with 4 articles A, B, C, D
>and i've got a second table 2 with articles B, D, E, F,
>and I want to create a third (temp)table 3 with the articles from table 1 &
>2, from A throw F.
>
>How do I manage that?
How about select col1
from table_1
union
select col2
from table_2
into temp table_3 ?
Robert Taylor wrote:
>
> If I'm getting you right ( excuse me if I'm not )
>
> SELECT
> t1.A, t1.B, t1.C, t1.D, t2.e, t2.f
> FROM
> table1 t1, table2 t2
> WHERE
> ( t1.B = t2.B and t1.D = t2.D )
> INTO TEMP t_table1_table2 WITH NO LOG;
>
> Obvioulsy use just the select part to do an unload or whatever to check it
> works. Then incorporate it into an INSERT or use it to create a temporary
> table etc.
Or for a permanent table, after creating the table:
INSERT INTO newtableSELECT
t1.A, t1.B, t1.C, t1.D, t2.e, t2.f
FROM
table1 t1, table2 t2
WHERE
t1.B = t2.B and t1.D = t2.D;
Art S. Kagel