1
I don’t know if the title is appropriate, but come on.
I have in Table A (table of consulted processes) two key fields (new process and old process) and I have in Table B my variable of interest (new process). In Table C, I have the conversion of the old process to the new one. Illustrating:
Table A
pcs_novo pcs_antigo outras_A
A NULL X
B NULL X
NULL AA X
NULL BB X
C NULL X
A NULL X
NULL AA X
Table B
pcs_novo assunto
A 1
B 2
C 3
D 4
E 5
F 6
Table C
pcs_antigo pcs_novo
AA D
BB E
CC F
Naturally, I want to:
Final Table
pcs_novo pcs_antigo assunto outras_A
A NULL 1 X
B NULL 2 X
D AA 4 X
E BB 5 X
C NULL 3 X
How do I get it?
Notes: In Table A the process fields are repeated. In Table B and C the fields are unique.
Using joints.
LEFT JOINS
seem the most appropriate– Jefferson Quesado
How would I do that?
– Yuri Camara Batista
the structure does not seem to be correct, would have some model ER ?
– Rovann Linhalis
@Yuricamarabatista: Is the database manager Mysql or SQL Server? Both are defined as tag.
– José Diz
SQL Server, I will fix, thank you
– Yuri Camara Batista