building a query

C

Caleb

Okay, I have a field called OrderId, now OrderId is a number that is placed
one one person for each item they ordered, Each item has its own record.I
want to make a query that will only show one of each OrderId therefore only
one record per person or order.
thanks in advance,
caleb
 
A

Armen Stein

Okay, I have a field called OrderId, now OrderId is a number that is placed
one one person for each item they ordered, Each item has its own record.I
want to make a query that will only show one of each OrderId therefore only
one record per person or order.
thanks in advance,
caleb

Build a Totals query, and use Group By on both PersonID and OrderID.
This will give you one record for each Person/Order combination.

I think your database design may be sub-optimal though. Shouldn't you
have an Order table with another child table holding multiple
OrderDetails?

tblPerson
PersonID
PersonName
....

tblOrder
OrderID
PersonID (foreign key)
OrderDate
....

tblOrderDetail
OrderDetailID
OrderID (foreign key)
OrderDetailQty
ItemID (foreign key to Item table?)
....

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
Top