Sunday 15 September 2013

php - MySQL Script to SET new Column Values Based on Another Columns value -


I have an existing database with the existing table and in that table I have a column called "pakinieno" . I have more than 400 rows of database contents Each unique line has a package number but now, I have added a column called "PackageWidchers" which is for package details. New column is now empty. But I have a legend for the package description in PHP code, for example:

  if ($ packageno == 1) {$ description = 'internal rooms'; } If (packaged == 2) {$ description = 'external cell'; }   

etc ..

But from the beginning, I did not add the details. Instead, I added the package number.

So, what I would like to do is update or set the empty database field in those packed database columns, with actual details of the package. How do I write a MySQL script to enter details of all existing rows using Packenano?

I know a little MySQL but I have never done anything with such existing lines.

Any help would be appreciated!

update will be queried

  UPDATE table_name SET packagedescription = 'internal room' WHERE packageno = 1 UPDATE table_name SET packagedescription = 'outer room' ou packageno = 2   

equally for others ....

No comments:

Post a Comment