Copy row(s) into same table in MySQL

I have a litte trouble when I want to copy row from another row in same table with MySQL, after a little googling, I found the solution is very beautiful, we just have to add 2 command like below.


SELECT rowName FROM tableName FOR UPDATE;
UPDATE tableName SET rowName2 = rowName;

It is easy right? I post as a little article like this just to want help another people with same problem. So, hope this post is helps you, enjoy! 😀

Regards,

One thought on “Copy row(s) into same table in MySQL”

Leave a Reply

Your email address will not be published. Required fields are marked *