I have data in 2 tables like this:
Table2010
ShipmentID (unique, PK)
ShipMonth
ShipYear
Weight
Table2011
ShipmentID (unique, PK)
ShipMonth
ShipYear
Weight
Each record represents a shipment. I am trying to do the following:
For the same total weight in a given calendar month, I want to compare the number of shipments (number of records) in 2011 that resulted for the same total weight for the previous year's month.
For example:
Table2010
ShipID DateMonth DateYear Weight (lb)
100 01 2010 200
101 01 2010 200
102 01 2010 200
Table2011
ShipID DateMonth DateYear Weight (lb)
100 01 2011 300
101 01 2011 350
The resulting record should look like:
DateMonth PrevYearSummedWeight ShipCount2010 ShipCount 2011
01 600 3 2
I've tried a ton of ways to include a where clause subquery to compare summed amounts, but nothing is working.
Any help is greatly appreciated!
Thanks.
Table2010
ShipmentID (unique, PK)
ShipMonth
ShipYear
Weight
Table2011
ShipmentID (unique, PK)
ShipMonth
ShipYear
Weight
Each record represents a shipment. I am trying to do the following:
For the same total weight in a given calendar month, I want to compare the number of shipments (number of records) in 2011 that resulted for the same total weight for the previous year's month.
For example:
Table2010
ShipID DateMonth DateYear Weight (lb)
100 01 2010 200
101 01 2010 200
102 01 2010 200
Table2011
ShipID DateMonth DateYear Weight (lb)
100 01 2011 300
101 01 2011 350
The resulting record should look like:
DateMonth PrevYearSummedWeight ShipCount2010 ShipCount 2011
01 600 3 2
I've tried a ton of ways to include a where clause subquery to compare summed amounts, but nothing is working.
Any help is greatly appreciated!
Thanks.