Re: one for the mysql server gurus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am no guru, but I carried out the following test

mysql> select * from t;
+------+-------+
| c1   | c2    |
+------+-------+
|    1 | hello |
|    2 | hello |
|    3 | NULL  |
|    4 | NULL  |
|    5 | Helly |
|    6 | Nelly |
|    7 | Kelly |
+------+-------+
7 rows in set (0.00 sec)

mysql> update t set c2 = replace(t2,'hell', 'heaven');
ERROR 1054: Unknown column 't2' in 'field list'
mysql> update t set c2 = replace(c2,'hell', 'heaven');
Query OK, 2 rows affected (0.00 sec)
Rows matched: 7  Changed: 2  Warnings: 0

mysql> select * from t;
+------+---------+
| c1   | c2      |
+------+---------+
|    1 | heaveno |
|    2 | heaveno |
|    3 | NULL    |
|    4 | NULL    |
|    5 | Helly   |
|    6 | Nelly   |
|    7 | Kelly   |
+------+---------+
7 rows in set (0.01 sec)


The update statement found 7 rows (all of the rows in my table bcos
there was no where clause, and only two rows actually got updated.


Regards from VJ


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux