Update many records, with one value
For this example, we have a products table called products_table, that has the following fields:
We would like to put them all in the same category called 'General'.
Using phpMyAdmin, browse to the correct table.
- Select the SQL tab.
- Enter the following SQL code in the box provided.
UPDATE products_table SET category = 'General' WHERE id > 0
Note that omitting the use of a WHERE statement, will ensure that all records are updated.
If you wanted to change category from General to Misc you could run the following SQL code:
UPDATE `products_table` SET category = 'Misc' WHERE `category`='General'
Thanks for visiting.