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 Query problem

Status
Not open for further replies.

roaml

Technical User
Feb 19, 2002
264
US
Hello,

I need help on a join query. I have a customer table and an Order table (see below).

Customer:
custid (pk)
name
address
city
state

Order:
orderid (pk)
custid (fk)
prodname
qty

I would like to create a report on one customer (custid) and all Orders (orderid) associated with that one customer. How would I join this in a query to get what I need?
 
You need a normal Inner Join

ie

SELECT Name,prodname,qty
FROM Customer
INNER JOIN Order
ON Customer.Custid = Order.CustId
WHERE (Any criteria you might want) eg Name = "Smith"

Hope that helps

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top