0
I have an appointment taking away my patience, I have to join two tables of different years, but the reference codes changed from one year to another. How do I keep information on the same line.
Table 1
Ano | Codigo Produto | Nome produto | Valor
-----+----------------+--------------+------
2019 | XX | Caneta | 100
2019 | YY | Lapis | 150
2019 | ZZ | Papel | 50
Table 2
Ano | Codigo Produto | Nome produto | Valor
-----+----------------+--------------+------
2018 | SS | Caneta A | 100
2018 | GG | Lapis X | 150
2018 | ZZ | Papel | 80
Result Table
Ano | Codigo Produto | Nome produto | Valor | Ano | Codigo Produto | Nome produto | Valor
-----+----------------+--------------+-------+------+----------------+--------------+------
2019 | XX | Caneta | 100 | 2018 | SS | Caneta A | 100
2019 | YY | Lapis | 150 | 2018 | GG | Lapis X | 150
2019 | ZZ | Papel | 50 | 2018 | ZZ | Papel | 80
As you can see I need to join both data on the same line, but there is nothing equal in lines 1 and 2 of the tables, I would need to say that the Product code 2018 "SS" is equal to the Product code 2019 "XX" and that "YY" is equal to "GG".
Someone could help in this trouble?
Thank you.
Okay Arthur, thanks for your help, I’ll try.
– ELKM