Modify one field at a time
Again, be careful with syntax. Quote marks need to go around text but not around numbers.
mysql 4.1.16-nt-max> update table01 set
field03='new info' where field01=1;
Query OK, 1 row affected (0.00 sec)
Change multiple fields at once
Remember to put commas between each field you're updating.
mysql 4.1.16-nt-max> update table01 set field04=19991022, field05=062218 where field01=1;
Query OK, 1 row affected (0.00 sec)
So, what's up with our data?
mysql 4.1.16-nt-max> select * from table01;
| field01 |
field02 |
field03 |
field04 |
field05 |
| 1 |
first |
new info |
1999-10-22 |
06:22:18 |
| 2 |
second |
another |
1999-10-23 |
10:30:00 |
| 3 |
third one |
more foo for you |
1999-10-24 |
10:30:01 |
Update multiple records in one stroke
mysql
4.1.16-nt-max> update table01 set field05=152901 where
field04>19990101;
Query OK, 3 rows affected (0.00 sec)
Survey says...
mysql 4.1.16-nt-max> select * from
table01;
| field01 |
field02 |
field03 |
field04 |
field05 |
| 1 |
first |
new info |
1999-10-22 |
15:29:01 |
| 2 |
seconn |
another |
1999-10-23 |
15:29:01 |
| 3 |
third one |
more foo for you |
1999-10-24 |
15:29:01 |
Wee haw! |