Question need help to match the sum of column values to another table

I don't follow! Upload a cut down version of your db so I can see these tables.
 
table 1-
Class Value
Class 0 100
Class 1 2000
Class 2 3000
Class 3 4000
Class 4 5000

Table2-
Month Class Value
1 Class 0 1000
1 Class 1 1000
1 Class 2 1000
1 Class 3 1000
1 Class 4 1000
2 Class 0 10000
2 Class 1 10000
2 Class 2 10000
2 Class 3 10000
2 Class 4 10000

similarly for other months upto 12.

Is there any way to join them and sum the column "value" of table1 and based on the sum i ll apply that IIF formula in the other link.
 
There are two ways you can join both tables:

1. Use a UNION ALL query... research this
2. Sum Table2 grouped by Class to get this:
Code:
Class		SumOfValue
-------		----------
Class 0 	11000
Class 1 	11000
Class 2 	11000
Class 3 	11000
Class 4 	11000
... then join the query above with Table1 via Class, add Table2.SumOfValue + Table1.Value and sum the result.

But why do you have two similar tables?
 
sorry for the confusion-

i want to sum all the values in column-"Value1".These are two separate tables .table 2 based on months and value 2 is input by user just like value1.

table 1-
Class Value1
Class 0 100
Class 1 2000
Class 2 3000
Class 3 4000
Class 4 5000

Table2-
Month Class Value2
1 Class 0 1000
1 Class 1 1000
1 Class 2 1000
1 Class 3 1000
1 Class 4 1000
2 Class 0 10000
2 Class 1 10000
2 Class 2 10000
2 Class 3 10000
2 Class 4 10000

similarly for other months upto 12.

Is there any way to join them and sum the column "value1" of table1 and based on the sum i ll apply that IIF formula in the other link.
 
What doesn't work about the solution in post #3?
 

Users who are viewing this thread

Back
Top Bottom