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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL join on two tables

Status
Not open for further replies.

mcginty

IS-IT--Management
Mar 14, 2001
35
IE
Hi,

I am trying to select data from two tables which have no foreign key. Can I join these two tables using two fields in each table? eg. select tbl1.a, table1.b from table1, table2 where table1.a=tbl2.a and table1.b=table2.b

I've tried inner joins with no success.
Thanks in advance,
Mac
 
If you are doing what you said and it is not working check for field lengths on the various tables. I.E. are table.a and table2.a the same length if not you will have various problems due to the way fields are matched, try to put the longer field on the left of the equals and see if that helps. You could also trim or pad the fields to make them equal length.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top