0
I have four tables
tabela A aic002
campos :
codigo data nome especie valor rg cpf exped
Tabela B excli
campos
codigo nome rg cpf exped
tabela C imovel
Campos
codigo imovel rua bairro cidade estado
tabela D escritura
codigo data especie valor rua bairro cidade estado
I’d like to run a single insert
that:
- take the fields (date specify value) A and popularize in D that would be the scripture control table
- take fields (name rg Cpf exped ) of A and popularia in B thus creating a new client table
- take (street city state) of C and popularia in D to complete the addresses of customers
How to do this in a single insert
knowing that:
Tables A, B and C are related by code but the only one that does not repeat the code is Immovel Table C.
If I understood what you want is not possible with just one
insert
, it takes at least two since two tables will be written. It is unclear how the relationship is being done. You say what you take, but what you take? You take the specified columns. How to know what the line is? BTW your name is Mark or Joelias?– Maniero
This is Joelias Marcos. is that I wanted to do the Insert without having to update one of the already populated tables that in case it would be table d writing.So from what I understand I will be obliged to do the update...
– Joelias Andrade
It’s not right but I think it’s the way...
– Joelias Andrade
When you go to add information, edit the question and leave everything organized. I gave an improved because the question was very messy. In the commentary it becomes more difficult to read something and understand.
– Maniero
Insert into scriptures (Tipoimoveldescr,STREET,NEIGHBORHOOD,UF) select DISTINCT a. DESCRICAO,a. STREET,a. NEIGHBORHOOD,a. CITY,a. state from immovable to INNER JOIN scriptures b on a.BOOK = 'E0285155' INNER JOIN aic002 c on a.BOOK = c.CODIGO group by a.BOOK (rodo o select mas não devolve nada no select no select me no select)
– Joelias Andrade