List:General Discussion« Previous MessageNext Message »
From:umapathi b Date:September 8 2011 7:32am
Subject:strange mysql update ..
View as plain text  
I wanted to change the login_date of one user . The original data of that
user is like this ..

select * from user_info where user_id = 16078845 \G
*************************** 1. row ***************************
           user_id: 16078845
   drivers_license: TEST1140DL
        login_date: 2011-06-19 11:20:07
         course_id: 1011
      regulator_id: 10840
         test_info: 11111111
   completion_date: 2011-06-19 11:37:16
        print_date: NULL
          password: test1140dl
certificate_number: NULL
             login: test1140dl@stripped

I fired the update statement in a wrong way ..like this ..

update user_info set login_date='2011-08-05 04:15:05' and user_id =16078845
limit 1 ;
( I forgot to use where . instead of where I used and )
update user_info set login_date='2011-08-05 04:15:05' where user_id
=16078845 limit 1 ; ( this is the query intended )

after the update ..I got this message ..
mysql> update user_info set login_date='2011-08-05 04:15:05' and user_id
=16078845 limit 1;
Query OK, 1 row affected, 1 warning (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

It shows that one record is affected and one row changed ..
I did show warnings ..the output is like this ..

mysql> show warnings;
+---------+------+---------------------------------------------------------+
| Level   | Code | Message                                                 |
+---------+------+---------------------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: '2011-08-05 04:15:05' |

+---------+------+---------------------------------------------------------+

But I could not get any record in the table with the updated login_date ..
mysql> select * from user_info where login_date like '2011-08-05%' ;
Empty set (0.67 sec)

So my question is what happened exactly ?
Why no records updated ?

Help is highly appreciated in this regard ..

- Umapathi
umapathi.b@stripped

Thread
strange mysql update ..umapathi b8 Sep
  • Re: strange mysql update ..Ananda Kumar8 Sep
    • Re: strange mysql update ..umapathi b8 Sep
      • Fwd: strange mysql update ..umapathi b9 Sep
        • Re: strange mysql update ..Derek Downey9 Sep
  • Re: strange mysql update ..Rik Wasmus8 Sep
    • Re: strange mysql update ..Suresh Kuna9 Sep