Link to home
Start Free TrialLog in
Avatar of sam2929
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)
ASKER CERTIFIED SOLUTION
Avatar of Argenti
Argenti
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

To get a cartesian, remove the join all together:

select a_id, a_text, b_id, b_text from table_a, table_b;
:(

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