Web Hosting Talk







View Full Version : Change blocks of data in by database


registercheaper
10-30-2009, 08:33 PM
Hello,
I have a data base with over 20000 rows of data. I would like to change about 1000 rows of data in the table but do not know how to do this without deleting all the other table data. I was trying to use the UPDATE command but I keep getting errors. Can someone take a look at the two databases I have attached and let me know what commands to use in the new.txt database so I can upload it to my server without altering all the other data.
In summary, Im tring to update the old.sql with the new info in new.sql without changing all the unaffected files.

eg: UPDATE INTO `video2` or INSERT INTO ETC ETC

Thanks

stahightech
10-31-2009, 09:46 AM
Hi,

Your update statement is incorrect. it should have the form

UPDATE video2
set [column_to_update1] = newValue1,
[column_to_update2] = newValue2,
[column_to_update3] = newValue3
where id = [some_id]

For example:

UPDATE video2
SET song = 'Roll It Gal',
url='youtube.com/watch?v=9DnmGoHvVgk'
WHERE id = 46449

You would have to create the above statement 1000 times for each row of data that you are updating.

There are some other ways, but they may be a little more complicated, and pruned to error if not fully understood. If you are going to be doing something like this on a regular basis, with large amounts of then I can make other suggestions.

I would post a link to the MySQL reference documents, but as a new member I don't believe I can.

registercheaper
10-31-2009, 02:50 PM
Thanks. It's been fixed. I was able to change the format with the update command within phpadmin and just as you said...it worked fine
Thanks again for your help