-1
Can you copy a record from a table and insert it in itself? I wanted to copy a record into a new one on the same table.
INSERT INTO Produtos ( Produto, Preco )
SELECT Produtos.Produto, Produtos.Preco
FROM Produtos
WHERE (((Produtos.Produto)="AN001"));
Hello! Out of curiosity, you tried to execute this already, and what was the result? any error message ?
– woliveirajr
This code returns some error?
– rray
If you’re having a hard time with this, maybe it’s because you’re doubling the Primary Key. Usually SQL tools allow this type of code, but this would only work in the form of the question if you have a code (ID) with auto increment.
– utluiz
@utluiz I was going to comment on keys, but I thought better to wait for a change in the question (more details: worked or not? with which error?) to then give an answer. I’m pretty sure your comment is the answer to the question
– woliveirajr
Regis, do not edit the title to "Solved". Post your solution and mark it as sure.
– utluiz
Don’t edit the question to apply the answer... I suggest you change the question so that it has the necessary code to notice the error that you discovered and after that, you put an answer to the solution, marking it as the correct answer, thus closing this subject. :)
– Zuul
You should add an answer instead of changing the question.
– Calebe Oliveira
I am trying to understand what is happening with this question at http://meta.answall.com/questions/533/o-que-esta-acontecendo-com-uma-questiona-ja-resolver
– Maniero
I cannot post an answer to myself, but as I said. It has already been solved, and the correct answer is in the sequence.
– Regis Santos
@Regisdasilva We are trying to reopen the question, then you can post an answer. If you prefer, you can also simply delete the question (i.e. if you find that it is not very useful to keep the question on the site; but I am not saying that this is what needs to be done - the decision is yours alone!)
– mgibsonbr