Forum Discussion
JotaEfe
4 years agoNew Member
Create table using 2 tables and a third with multipliers
Hello! I hope I can explain what im trying to attemp I have 3 tables: Table 1& Table 2 have the following structure DATE | Name | Value (date)| ID 1 | Value 1 I have many ID's w...
- 4 years ago
- JotaEfe4 years agoNew Member
These are the 3 tables
DATE ID Product 1/1/2021 A 123 2/1/2021 A 121 3/1/2021 A 128 1/1/2021 B 243 2/1/2021 B 233 3/1/2021 B 242 1/1/2021 C 565 2/1/2021 C 566 3/1/2021 C 556 DATE ID2 Product2 1/1/2021 J 5 2/1/2021 J 6 3/1/2021 J 5 1/1/2021 Q 3 2/1/2021 Q 2 3/1/2021 Q 3 1/1/2021 M 1 2/1/2021 M 1 3/1/2021 M 1.1 ID1 ID2 f A J 0.5 A Q 0.3 B J 0.5 B Q 0.3 B M 0.5 C M 0.5 This is the desired output:
DATE ID Product Asoc. Prod 1/1/2021 A 123 3.4 2/1/2021 A 121 3.6 3/1/2021 A 128 3.4 1/1/2021 B 243 3.9 2/1/2021 B 233 4.1 3/1/2021 B 242 3.95 1/1/2021 C 565 0.5 2/1/2021 C 566 0.5 3/1/2021 C 556 0.55 For example in the first row Asoc prod = 5 * 0.3 + 3 *0.3