Supprimer un message
blietaer
Une table.
Une colonne de timestamp, du genre:
+-----------------+
| timestamp |
+-----------------+
| 16:07:03.611959 |
| 16:07:05.031506 |
| 16:07:05.158316 |
| 16:07:05.158477 |
| 16:07:05.192583 |
| 16:07:05.291956 |
| 16:07:05.319757 |
| 16:07:05.411969 |
| 16:07:05.441306 |
| 16:07:05.542032 |
+-----------------+
Pas besoin de la micro-seconde, donc on arrondi:
+-----------------------------------------------------------------------------------------------+
| CONCAT(SUBSTRING(timestamp, 1,9), SUBSTRING( LPAD(SUBSTRING(timestamp,10,6)+500, 6,'0'),1,3)) |
+-----------------------------------------------------------------------------------------------+
| 16:07:03.612 |
| 16:07:05.032 |
| 16:07:05.158 |
| 16:07:05.158 |
| 16:07:05.193 |
| 16:07:05.292 |
| 16:07:05.320 |
| 16:07:05.412 |
| 16:07:05.441 |
| 16:07:05.542 |
+-----------------------------------------------------------------------------------------------+
10 rows in set (0.00 sec)
Mais maintenant je veux placer ce résultat dans une autre colonne (vierge) de la MEME table..
Donc,
UPDATE mytable SET champ_vierge = ....?
merci!
Une colonne de timestamp, du genre:
+-----------------+
| timestamp |
+-----------------+
| 16:07:03.611959 |
| 16:07:05.031506 |
| 16:07:05.158316 |
| 16:07:05.158477 |
| 16:07:05.192583 |
| 16:07:05.291956 |
| 16:07:05.319757 |
| 16:07:05.411969 |
| 16:07:05.441306 |
| 16:07:05.542032 |
+-----------------+
Pas besoin de la micro-seconde, donc on arrondi:
+-----------------------------------------------------------------------------------------------+
| CONCAT(SUBSTRING(timestamp, 1,9), SUBSTRING( LPAD(SUBSTRING(timestamp,10,6)+500, 6,'0'),1,3)) |
+-----------------------------------------------------------------------------------------------+
| 16:07:03.612 |
| 16:07:05.032 |
| 16:07:05.158 |
| 16:07:05.158 |
| 16:07:05.193 |
| 16:07:05.292 |
| 16:07:05.320 |
| 16:07:05.412 |
| 16:07:05.441 |
| 16:07:05.542 |
+-----------------------------------------------------------------------------------------------+
10 rows in set (0.00 sec)
Mais maintenant je veux placer ce résultat dans une autre colonne (vierge) de la MEME table..
Donc,
UPDATE mytable SET champ_vierge = ....?
merci!