Advanced query

P

Petterq

I have an customer database, with a table of customers, and an order table.

Each customer can order a variety of products. If the order a product with a
spesific product group, they are entitled to customer support for all the
products they have ordered.

I need a query that lists all customers that have ordered a product form
this product group, with all the items they have ordered (also from other
product groups). The query should ignore customers who have no order of
products from the speciific group.

How can this be done?
 
J

jahoobob

If you have a table of products with the group to which each belongs,
then you should be able to query the Customer table, the Order table
and the Product table.
You can do te same with your two tables if you include the product
group in the Orders table, but you are adding overhead when you store
the group in each order record.
 
J

John Spencer (MVP)

Create a query that shows all the customers that have ordered the product and
save it as a named query (CustomersOrderingProduct)

Now build another query with that query and your other tables. Joining the
customerID from the query to the customerid in the customers table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top