Crosstab Query

P

Paula

A query contains the fields CustomerID, CustomerName, OrderID and ItemID.
The query is based on a customers table, orders table, and order details
table. The orders table has a foreign key of CustomerID and is joined to
CustomerID in the customer table. The order details table has a foreign key
of OrderID and is joined to OrderID in the orders table. How do you create a
crosstab query that shows the total nunber of orders placed by each customer
and the total number of items ordered by each customer? Like the following:
CustomerName Total Orders Placed Total Items Ordered

Thanks!

Paula
 
S

Sirocco

I'm not sure if a crosstab is what you want. I would determine the 2 totals
using 2 separate aggregate queries, then join these 2 in a 3rd (select)
query. Keep the Customer Name in each of the 2 totals queries, and use
this field to link the 2 source objects in the 3rd.
 
P

Paula

Thank you for replying!

I also need to group by year to get:
Current Year Current Year - 1 etc
Total Orders Total Items Total Orders Total Items
So I need to do a crosstab.

Paula
 

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

Similar Threads


Top