I have a table with the following column & value:
ColA = "8765" ColB = "2137"
I would like to update ColB in the same table to the following value:
ColC = "[8765][2137]"
How can I do it using phpmyadmin (meaning just sql syntax)?
UPDATE table SET col = new_value WHERE col = old_value AND other_col = some_other_value; UPDATE table SET col = new_value WHERE col = old_value OR other_col = some_other_value; As you can see, you can expand the WHERE clause as much as you'd like in order to filter down the rows for updating to what you need.
MySQL UPDATE multiple columnsMySQL UPDATE command can be used to update multiple columns by specifying a comma separated list of column_name = new_value. Where column_name is the name of the column to be updated and new_value is the new value with which the column will be updated.
UPDATE table SET ColC = CONCAT("[", ColA, "][", ColB, "]");
UPDATE myTable SET ColC = CONCAT('[', ColA, '][', ColB, ']') --WHERE...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With