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

Join between two tables

Status
Not open for further replies.

impulse24

IS-IT--Management
Jul 13, 2001
167
US
I have two tables Import, and Books. There are four fields in each table. I want to do a cross query. But the only thing that makes that data unique is that a unique record is combined of all four fields. How do i create the relationship between the two tables?


Example:

Import Table
Book Name
Author
Price
Date

Books Table
Book Name
Author
Price
Date

The combination of all four fields makes the record unique. I want to see which books records are in the import table that are not in the Books table. I have been searching for days. Please help
 
select * from imports where not exists
(select * from books where
books.bookname = import.bookname and
books.author = import.author and
books.price = author.price and
books.date = author.date )
 
Thanks for the help. Wish I had designed the database fluteplr, I would have used a primary key, it would have helped me avoid this headache.. But my customer is feeding me the data, and they don't know what they are doing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top