What type of JOIN would I use to get table1
and table2
to be matched only once. For example, I have table1
(40 rows) and table2
(10000 rows). But I get table1
repeated over and over when I use a join on table1.LocationArea = table2.Location
What I get: What I wish I could get:
t1.LocationArea,t2.Location t1.LocationArea,t2.Location
--------------------------- ---------------------------
az,az az,az
az,az null,az
ca,ca ca,ca
il,il il,il
tx,tx tx,tx
tx,tx null,tx
az,az null,az
null,il
null,ca
I wish to end up with 10000 records in the query.
I have tried inner join
, left
, and I am using ZOHO reports which does not support outer join's.
SELECT "table1"."LocationArea", "Location"
FROM "table2"
left join "table1" on "Location" = "table1"."LocationArea"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…