Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Need Help Joining Crosstab Queries

Author  Topic 

Jason2112
Starting Member

17 Posts

Posted - 2009-03-31 : 04:00:15
I have a single table of sales data that I am working with, the fields are:
-SalespersonNo
-CustomerNo
-ProductType
-PostingDate
-DollarsSold
-QtySold
I need to organize the data by month for 2 years so I can show comparison between current year and last year for DollarsSold and QtySold for each ProductType. I was able to create a crosstab query for 08 data and one for 09 data, and on their own they have everything I need. The problem is when I try to join them in a simple query to combine the 08 and 09 data for each ProductType, I get a bunch of duplicate records. Nothing I've tried so far is giving me accurate data when I try to combine the two crosstab queries.

Also I have tried to set the data range for a single crosstab query to include 08 and 09 data (basically said WHERE PostingDate BETWEEN 01/01/2008 AND 12/31/2009), but the query combines the 08 and 09 SalesDollars for each month (Jan = Jan08 + Jan09 combined). I'm running out of time on this project and need some help.
   

- Advertisement -