Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table joining problem

Status
Not open for further replies.

CSOP

Technical User
Sep 26, 2003
9
GB
Hi,

I'v got 2 tables: table a and table b. Both have the same primary key which is a unique reference number.
However table a is general, and has every single refernce number, and table b is specific to a particular area in the dbs, and represents data which comes under a specidic category (ie all unique reference numbers which satisfy this given criteria).

My problem is, I want every single unique refernce number represented ie from table a, and want to link it to table b. (even if this means i have empty rows for data which is in table a and not in b
The problem is, every single unique reference number is not apperaring. Only table b reference numbers.

Please help this is really bothering me

thanks :)
 
You need to use an outer join.
e.g.
select *
from a
left outer join b on a.ID_Field =b.ID_Field
 
how about this:
SELECT a.*
FROM table1 a LEFT OUTER JOIN table2 b ON
a.referenceNB = b.referenceNB
 
thankyou so much guys, that helped a lot and have now got the exact data I need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top