1 Attachment(s)
Now A really complex query...
well.. thank to szlamany, i saw that my last post was quite simple... :blush:
and my problem a bit more complicated..
i'll try to tell exactly what i need
i have a table called Foto, one called Noticia, Area and one called Unidade.
i need to make a copy of everything associated with idUnidade = 17
but in another idUnidade (30)..
so if i have one Row in Noticia with idNoticia = 30 and the idUnidade from that idArea is 17, than i need it to be copied AND the data from table Foto that have the idNoticia = 30, will be copied and idNoticia will be updated to the idNoticia of the new data...
:confused:
i don't know it can be done only with SQL Server.. so, if don't, could someone suggest a program to help me!?
thanks in advance...
Re: Now A really complex query...
First I would suggest using a STORED PROCEDURE to create a table variable - load it with the data you want and then INSERT from it.
Keep in mind that you can say something like this in SQL.
Code:
Insert into Area
Select idArea,Nome,30,layoutChamada,quantidade,layout From Area
Where idUniDade=17
This will create new rows in Area - with the idUniDade of 30, but from a population of data that has the value 17 - basically copying 17 to 30.