I'm not a complete novice at databases and I could certainly do this in Excel but cannot
seem to get it to work in Access:
I have a query that sums values for products the results of which look like this (though there are actually >100 sum columns):
Pname___Asum____Bsum_____Csum
----------------------------------
p1_______ 1 ______ -5 ______ 25
p2_______ 3 ______ -9 ______ 0
p3_______ 0 ______ -100 ____ 1
I have a table with multipliers that I want to apply to the respective columns:
id ____ ABC _____ multi
------------------------
1 _____ A _______ 1.2
2 _____ B _______-1
3 _____ C _______ 0.25
I want to multiply the values in the columns of the query by the respective multi value in the table and then sum the colums for each row.
The calculation would look like this - the brackets are only to make it easier to read.
p1: (1*1.2)+(-5*-1)+(25*0.25)
p2: (3*1.2)+(-9*-1)+(0*0.25)
p3: (0*1.2)+(-100*-1)+(1*0.25)
The result I'm after is something like this:
Pname ___ Value
----------------
p1 _______ 12.45
p2 _______ 32.40
p3 _______ 100.25
I'd be most grateful for any clues on how to achieve this.
Thanks
seem to get it to work in Access:
I have a query that sums values for products the results of which look like this (though there are actually >100 sum columns):
Pname___Asum____Bsum_____Csum
----------------------------------
p1_______ 1 ______ -5 ______ 25
p2_______ 3 ______ -9 ______ 0
p3_______ 0 ______ -100 ____ 1
I have a table with multipliers that I want to apply to the respective columns:
id ____ ABC _____ multi
------------------------
1 _____ A _______ 1.2
2 _____ B _______-1
3 _____ C _______ 0.25
I want to multiply the values in the columns of the query by the respective multi value in the table and then sum the colums for each row.
The calculation would look like this - the brackets are only to make it easier to read.
p1: (1*1.2)+(-5*-1)+(25*0.25)
p2: (3*1.2)+(-9*-1)+(0*0.25)
p3: (0*1.2)+(-100*-1)+(1*0.25)
The result I'm after is something like this:
Pname ___ Value
----------------
p1 _______ 12.45
p2 _______ 32.40
p3 _______ 100.25
I'd be most grateful for any clues on how to achieve this.
Thanks
Last edited: