We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
Article:
 |
|
More on JOINS
|
| Subject: |
|
Relationship: one to one |
| Date: |
|
2001-06-08 06:14:43 |
| From: |
|
wallinbl
|
Response to: Relationship: one to one
|
|
If you have a Customer Table (with columns CustKey, CustFirstName, CustLastName) and an Address Table (with columns AddrKey, CustKey, AddrLine1, AddrLine2), to get all fields from both tables, you would write a query like this:
SELECT * FROM Customer INNER JOIN Address ON
Customer.CustKey = Address.CustKey
This statement would return the fields: Customer.Custkey, Customer.CustFirstName, Customer.CustLastName, Address.AddrKey, Address.CustKey, Address.AddrLine1, Address.AddrLine2.
|