G
Guest
I'm hoping to perform the following with one SQL query
Group by ExpDate and Sum PdNet (sum in this example is 425.00
ExpDate PdNe
200404 100.0
200404 175.0
200404 150.0
And then allocate that sum to various CoCode based on percentages in tblAllo
For example, in tblAlloc I have
CoCode Allo
39 .6
52 .4
The final result should be to allocate the 425.00 sum 60% to CoCode 39 and 40% to CoCode 52. The first step (group and sum) is simple enough with the following SQL - I just can't get the allocation part to work. Thanks
PARAMETERS ExpDate Long
SELECT ExpDate, Sum(PdNet) AS PdNe
FROM tblHistGrantEx
GROUP BY ExpDat
HAVING (((ExpDate)=[ExpDate]))
Group by ExpDate and Sum PdNet (sum in this example is 425.00
ExpDate PdNe
200404 100.0
200404 175.0
200404 150.0
And then allocate that sum to various CoCode based on percentages in tblAllo
For example, in tblAlloc I have
CoCode Allo
39 .6
52 .4
The final result should be to allocate the 425.00 sum 60% to CoCode 39 and 40% to CoCode 52. The first step (group and sum) is simple enough with the following SQL - I just can't get the allocation part to work. Thanks
PARAMETERS ExpDate Long
SELECT ExpDate, Sum(PdNet) AS PdNe
FROM tblHistGrantEx
GROUP BY ExpDat
HAVING (((ExpDate)=[ExpDate]))