mysql update multiple columns -


I need to update 2 datetime columns, and I need them, using mysql version 4.1.20. I am using this query:

  mysql> Update table set last_update = now (), last_monitor = now () where id = 1;  

Is it safe or is there a chance that the columns are being updated with different times, because of 2 views call for (now)?
I do not think it should be updated with different values ​​(I think Invalial ISLL call is now just one time or something like this one), but I am not an expert, what do you think?

The second question why does this question? Update columns:

  mysql> Update table set last_update = last_monitor = now () where id = 1; The query is ok, the rows matching (0) seconds are affected by 0 rows: 1 changed: 0 warnings: 0  

Thanks.

found a solution:

  mysql> ; Update table SET last_update = now (), last_monitor = last_update WHERE id = 1;  

I have been found in MySQL docs and after some tests it works:

The following statement sets the colon to the ON (update) col1 value No, the original call 1 value is the result that col1 and col2 have the same value. This behavior varies from standard SQL.

UPDATE T1 SET col1 = col1 + 1, col2 = col1;

On the second question, there is no answer, nothing about this found on mysql documentation.


Comments