sam2929
asked on
cartesian join
Hi,
i have table A
A_ID A_TEXT
1 employee
5 terminated
9 inactive
Table B
B_ID B_TEXT
11 hOURLY
12 PARTTIME
15 >6 MONTH
I want target_a_b to look like below
A_ID A_TEXT B_ID B_TEXT
1 employee 11 hOURLY
1 employee 12 PARTTIME
1 employee 15 >6 MONTH
5 terminated 11 hOURLY
5 terminated 12 PARTTIME
5 terminated 15 >6 MONTH
9 inactive 11 hOURLY
9 inactive 12 PARTTIME
9 inactive 15 >6 MONTH
I did try FULL Outer join but not giving desire results
Select * From Table_ A a
FULL OUTER Join Table_B b
ON TRIM(a.A_ID) = TRIM(b.B_ID)
i have table A
A_ID A_TEXT
1 employee
5 terminated
9 inactive
Table B
B_ID B_TEXT
11 hOURLY
12 PARTTIME
15 >6 MONTH
I want target_a_b to look like below
A_ID A_TEXT B_ID B_TEXT
1 employee 11 hOURLY
1 employee 12 PARTTIME
1 employee 15 >6 MONTH
5 terminated 11 hOURLY
5 terminated 12 PARTTIME
5 terminated 15 >6 MONTH
9 inactive 11 hOURLY
9 inactive 12 PARTTIME
9 inactive 15 >6 MONTH
I did try FULL Outer join but not giving desire results
Select * From Table_ A a
FULL OUTER Join Table_B b
ON TRIM(a.A_ID) = TRIM(b.B_ID)
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
:(
as proponent of ANSI join syntax: never leave it open for mis-interpretation
select *
from table1
cross join table2
;
now you know (and the folks that follow) that the Cartesian product is deliberate
as proponent of ANSI join syntax: never leave it open for mis-interpretation
select *
from table1
cross join table2
;
now you know (and the folks that follow) that the Cartesian product is deliberate
select a_id, a_text, b_id, b_text from table_a, table_b;