Volume_Rate --
SELECT Rates_1.MatNo, Rates_1.FinYr, Rates_1.WkNo, Sum(Volume_1.Quant) AS
SumOfQuant, Rates_1.Rate
FROM Rates_1 INNER JOIN Volume_1 ON (Rates_1.MatNo = Volume_1.MatNo) AND
(Rates_1.WkNo = Volume_1.WkNo) AND (Rates_1.FinYr = Volume_1.FinYr)
GROUP BY Rates_1.MatNo, Rates_1.FinYr, Rates_1.WkNo, Rates_1.Rate;
TRANSFORM Sum([SumOfQuant]*[Rate]) AS Expr1
SELECT Volume_Rate.MatNo, Volume_Rate.FinYr
FROM Volume_Rate
GROUP BY Volume_Rate.MatNo, Volume_Rate.FinYr
PIVOT Volume_Rate.WkNo IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52);
access user said:
Hi Karl
Sorry for the delay and thanks for replying. Ok - I thought I'd step one
step back and let you see the underlying tables - Rate and Volume.
Rates Table:
MatNo WkNo AcWkNo FinYr Rate
AA06 27 6 2006 0.72
AA06 27 6 2006 0.72
AA06 27 6 2006 0.72
AA06 21 52 2006 13.68
AA06 21 52 2006 13.68
AA06 21 52 2006 13.68
AA06 21 52 2006 13.68
AA06 21 52 2006 13.68
AA06 21 52 2006 13.68
Volume Table:
DelTo PropNo MatNo WkNo AcWkNo FinYr Quant
558473 100278 AA06 22 1 2006 0.25
575168 100725 AA06 22 1 2006 0.25
580980 100916 AA06 22 1 2006 1
638208 100679 AA06 22 1 2006 0.25
645911 100136 AA06 22 1 2006 0.25
812318 100138 AA06 22 1 2006 0.25
846978 100174 AA06 22 1 2006 0.25
78422 100917 AA06 21 52 2006 0.5
532210 100049 AA06 21 52 2006 0.25
The crosstabs I was referring to were created from the above two underlying
tables just to show the weeks going across. But this is probably not
necessary to do the multiplication. So, what I want is to multiply rate by
volume for each MatNo, WkNo combination, grouping the MatNo by PropNo in the
Volume table.
I'm still working on the SQL and will post what I have soon.
James
TIA