Description:
Ver:5.1.31
Engine:InnoDB
oot:DbStatus> select * from xjc where f_ip='10.10.3.65' and f_type='cpu_use' and f_report_date='2009-01-11 19:15:00'
-> ;
+---------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
| f_host | f_ip | f_port | f_class | f_desc | f_type | f_values | f_content | f_report_date |
+---------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
| park-s1 | 10.10.3.65 | 0 | myclass | | cpu_use | 0.00 | | 2009-01-11 19:15:00 |
+---------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
1 row in set (0.00 sec)
root:DbStatus> update xjc set f_host='aa' and f_class='bb' where f_ip='10.10.3.65' and f_type='cpu_use' and f_report_date='2009-01-11 19:15:00';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
root:DbStatus> show warnings;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'aa' |
+---------+------+----------------------------------------+
1 row in set (0.00 sec)
root:DbStatus> select * from xjc where f_ip='10.10.3.65' and f_type='cpu_use' and f_report_date='2009-01-11 19:15:00';
+--------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
| f_host | f_ip | f_port | f_class | f_desc | f_type | f_values | f_content | f_report_date |
+--------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
| 0 | 10.10.3.65 | 0 | myclass | | cpu_use | 0.00 | | 2009-01-11 19:15:00 |
+--------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
1 row in set (0.00 sec)
When you use "update table_name set col1=new_value1 and col2 = new_value2 where conditions",It does not prompt syntax error but to execute this statement ,so you'll get a wrong value that is not your expectancy;
How to repeat:
Just use "update table_name set col1=new_value1 and col2 = new_value2 where conditions"