Help copy sql colume

Posted by jimmysback, 03-04-2010, 05:23 PM
Hi guys i need some help desining a sql query what i have is a table that has a few columes within the 1 table. the colume's are id, ulr and url2 now what i want to do is copy between row 100-200 from ulr to url 2. now the tricky bit is that the colume id is an auto incrementing so when i run the command shown blog.ekram.info/copy-data-from-one-column-to-another-column-in-mysql/ it seems to add as extra rows when it should be adding in the same row. i would appreciate if someone could help point me in the right direction better give me an example code. Thanks

Posted by mattle, 03-04-2010, 06:26 PM
That example is inserting data from one table into another. That's not what you want. I'm not going to write the SQL for you here (yeah, I'm one of those jerks that wants you to learn something...), however the format is pretty simple. Hey database I'd like to UPDATE column url2 to be EQUAL to column ulr WHERE column id is BETWEEN 100 AND 200

Posted by TheSimpleHost-Nathan, 03-04-2010, 08:32 PM
UPDATE table SET ulr2 = url WHERE id >= 100 AND id <= 200 Make sure you backup your database, don't trust me half asleep query

Was this answer helpful?

 Print this Article

Also Read

Recommendation

Posted by endin, 06-26-2008, 08:37 AMHi, please Recommendation for install script to faster...

Multiple sites running off same code

Posted by AimyThomas, 10-25-2012, 11:09 PMI m interested in making multiple websites, all with...

date --utc on VPS ?

Posted by enz0, 06-17-2008, 03:07 PMHi all, I just created a VPS with Empire VPS. I'm...

Not receiving some emails

Posted by Kain, 12-20-2007, 07:09 AMI've got a weird one here. A client is not receiving some...

php script security issues

Posted by CleverWebHost, 09-15-2008, 01:12 PMi am on a shared server with php script security...