oracle - SQL Join Issues with 2 Tables -
i have table field1 codes such 145, 156, 167 etc , have field2 same codes. in table b - have codes , locations such
145 birmingham 156 boise 167 raleigh i want display locations field1 , field 2 having problem join...
select a.field1, b.id, b.location, a.field2 table a left outer join table b b on a.field1 = b.id; i can see location description field1 - how retrieve location description field2 ???
you need join table b twice:
select a.field1, b1.id id1, b1.location location1, a.field2, b2.id id2, b2.location location2 tablea left outer join tableb b1 on a.field1 = b1.id left outer join tableb b2 on a.field2 = b2.id;
Comments
Post a Comment