0

For example with the following query I can select all the records I want to change, but then how do do the change? e.g. change all occurences of "seven" to "four"?

SELECT * FROM `templates` WHERE `attrib_B` LIKE `seven`

This is how I think of it in pseudo code:

if `attrib_B` like `seven`:
    set `attrib_B` = `four`

Thanks.

3 Answers 3

1
UPDATE `templates` set `attrib_b` = 'four' WHERE `attrib_B` like 'seven';
2
  • 1
    Just a side note that this is SQL and not specific to phpMyAdmin. Jan 6, 2010 at 21:58
  • I removed the phpmyadmin specificity Jan 6, 2010 at 22:04
0

[for myPHPAdmin as per original question verbiage]

You can use either the table editor to change the data rows manually (via web interface) or run a SQL UPDATE statement.

Manually updating via web interface:

  1. Click on your table in the menu on the left
  2. Click the Browse tab, which will display the data rows in an HTML table
  3. Click Edit on the row(s) you want to edit
  4. Change the values in the Edit form

Running a SQL UPDATE statement (faster as you can do them all at once):

  1. Click on your table in the menu on the left
  2. Click the SQL tab, which will give you a textbox you can enter a SQL statement into
  3. Use this SQL statement to update all the rows:

    UPDATE 'templates' SET 'attrib_B'='four' WHERE 'attrib_B' LIKE 'seven'

  4. Click the GO button to execute the statement

1
  • thanks squillman. Perhaps preface your answer with [For phpmyadmin] or similar as I've removed that from the question and it now appears out of context, but isn't. sorry for adding confusion! Jan 6, 2010 at 22:06
0

The question has already been answered, so I won't redo that but thought it might be handy to pass on a little tip for the future. It's helped me avoid excessive page turning of the manual many times.

An easy way to search the MySQL documentation is to use the URL http://dev.mysql.com/doc/, followed by your search term. e.g.

http://dev.mysql.com/doc/insert ignore

will search the online documentation for "insert ignore".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .