Hello Guys,
I am pulling my hair on this one... and I am sure there is an easy way to solve my issue. I have a main table and 4 tables that are joined to it.
I need to get the the average value of each "area" group where all the left side values are the same using the amount on the "VALUE" table and the description of the corresponding table. (in this result example I am just writing the code value)
Result should look similar as below, considering that the VALUES table has records with a value of $1 each. Your help is greatly appreciated, as at this stage I am creating temp tables.
Result:
A1:$4, B1:$1, C1:$1
A1:$4, B2:$3, C1:$2
A1:$4, B2:$3, C2:$1
A2:$2, B3:$2, C2:$2
MAIN table values example:
'A1', 'B1', 'C1', 'V1'
'A1', 'B2', 'C1, 'V2'
'A1', 'B2', 'C1', 'V3'
'A1', 'B2', 'C2', 'V4'
'A2', 'B3', 'C1', 'V5'
'A2', 'B3', 'C1', 'V6'
MAIN table structure:
- code1
- code2
- code3
- valuecode
TABLE1 structure
- description
- code1
TABLE2 structure
- description
- code2
TABLE3 structure
- description
- code3
VALUE structure
- description
- valuecode
- amount