While I was working on a project I needed to migrate some information from one table to the other. But only specific data. I was looking for a solution but I only found one easily for a mssql database. After some research I found a way to copy data from one to an other table while using where to filter:
UPDATE table1 tb1 INNER JOIN table2 tb2 ON tb1.id = tb2.sub_id SET tb1.field = tb2.field WHERE tb1.field = ''
With this query you can easily transfer data from table2 to table1
Robert-Jan de Dreuhttp://google.com
Hey, I'm Robert-Jan de Dreu. A programmer mostly focusing on the web. While using PHP and MVC I will make sure the program I'm building is well documented and structured. I use this blog to show what I made and keep reminding myself of little tasks that I have done and maybe need to do again.
I live in Utrecht, The Netherlands and can be found in Ibuildings where my job is at. I'm available for freelancing if you want me to do a project for you. Just send me a message.