Re: Update change values in wrong column
Actually, the column you're referring to is a TIMESTAMP. As the manual states, the first TIMESTAMP field in any table is automatically updated whenever a change occurs. If you don't want this value to change, you should use a DATETIME field instead. However, keep in mind that you'll have to change both your start and stop columns to DATETIME -- otherwise, the stop column will become the first TIMESTAMP and will begin updating automatically. http://www.mysql.com/doc/D/A/DATETIME.html --jeff - Original Message - From: "Shawn McCool" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 25, 2002 2:13 PM Subject: Re: Update change values in wrong column > You need a where clause at the end to tell it which row to update. > > [EMAIL PROTECTED] wrote: > > >. mysqladmin version > >mysqladmin Ver 8.21 Distrib 3.23.42, for apple-darwin1.4 on powerpc > >Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB > >This software comes with ABSOLUTELY NO WARRANTY. This is free software, > >and you are welcome to modify and redistribute it under the GPL license > > > >Server version 3.23.42-log > >Protocol version10 > >Connection Localhost via UNIX socket > >UNIX socket /tmp/mysql.sock > >Uptime: 1 day 7 hours 15 min 46 sec > > > >Threads: 1 Questions: 436 Slow queries: 0 Opens: 93 Flush tables: 2 > >Open tables: 0 Queries per second avg: 0.004 > > > >. Vendor Apple Blue&White G3 > >. MacOS X 10.1.3 > >. The included compiler in MacOSX Developer Tools gcc? > > > > > >THE ERROR > >See what happens in the start column, it change ?? when updating > >price column > > > >mysql> SELECT * FROM bookings; > >++++++ > >+---++ > >| id | start | stop | registrated| > >booking_object | booker | price | part_payed | > >++++++ > >+---++ > >| 1 | 20020324184014 | 20020321045959 | 20020323022729 | > >1 | 1 | NULL | NULL | > >| 2 | 20020324184014 | 20020330055959 | 20020324171150 | > >1 | 1 | NULL | NULL | > >++++++ > >+---++ > >2 rows in set (0.00 sec) > > > >mysql> UPDATE bookings SET price='0'; > >Query OK, 2 rows affected (0.01 sec) > >Rows matched: 2 Changed: 2 Warnings: 0 > > > >mysql> SELECT * FROM bookings; > >++++++ > >+---++ > >| id | start | stop | registrated| > >booking_object | booker | price | part_payed | > >++++++ > >+---++ > >| 1 | 20020324184136 | 20020321045959 | 20020323022729 | > >1 | 1 | 0 | NULL | > >| 2 | 20020324184136 | 20020330055959 | 20020324171150 | > >1 | 1 | 0 | NULL | > >++++++ > >+---++ > >2 rows in set (0.00 sec) > > > >mysql> desc bookings; > >++---+--+-+-++ > >| Field | Type | Null | Key | Default | > >Extra | > >++---+--+-+-++ > >| id | int(11) | | PRI | NULL| > >auto_increment | > >| start | timestamp(14) | YES | | > >NULL|| > >| stop | timestamp(14) | YES | | > >NULL|| > >| registrated| timestamp(14) | YES | | > >NULL|| > >| booking_object | int(11) | YES | MUL | > >NULL|| > >| booker | int(11) | YES | | > >NULL|| > >| price | text | YES | | > >NULL|| > >| part_payed | text | YES | | > >NULL|| > >++---+--+-+-++ > >8 rows in set (0.00 sec) > > > >Best Greetings > > > >Sive > > > > > > > >- > >Before p
Re: Update change values in wrong column
You need a where clause at the end to tell it which row to update. [EMAIL PROTECTED] wrote: >. mysqladmin version >mysqladmin Ver 8.21 Distrib 3.23.42, for apple-darwin1.4 on powerpc >Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB >This software comes with ABSOLUTELY NO WARRANTY. This is free software, >and you are welcome to modify and redistribute it under the GPL license > >Server version 3.23.42-log >Protocol version10 >Connection Localhost via UNIX socket >UNIX socket /tmp/mysql.sock >Uptime: 1 day 7 hours 15 min 46 sec > >Threads: 1 Questions: 436 Slow queries: 0 Opens: 93 Flush tables: 2 >Open tables: 0 Queries per second avg: 0.004 > >. Vendor Apple Blue&White G3 >. MacOS X 10.1.3 >. The included compiler in MacOSX Developer Tools gcc? > > >THE ERROR >See what happens in the start column, it change ?? when updating >price column > >mysql> SELECT * FROM bookings; >++++++ >+---++ >| id | start | stop | registrated| >booking_object | booker | price | part_payed | >++++++ >+---++ >| 1 | 20020324184014 | 20020321045959 | 20020323022729 | >1 | 1 | NULL | NULL | >| 2 | 20020324184014 | 20020330055959 | 20020324171150 | >1 | 1 | NULL | NULL | >++++++ >+---++ >2 rows in set (0.00 sec) > >mysql> UPDATE bookings SET price='0'; >Query OK, 2 rows affected (0.01 sec) >Rows matched: 2 Changed: 2 Warnings: 0 > >mysql> SELECT * FROM bookings; >++++++ >+---++ >| id | start | stop | registrated| >booking_object | booker | price | part_payed | >++++++ >+---++ >| 1 | 20020324184136 | 20020321045959 | 20020323022729 | >1 | 1 | 0 | NULL | >| 2 | 20020324184136 | 20020330055959 | 20020324171150 | >1 | 1 | 0 | NULL | >++++++ >+---++ >2 rows in set (0.00 sec) > >mysql> desc bookings; >++---+--+-+-++ >| Field | Type | Null | Key | Default | >Extra | >++---+--+-+-++ >| id | int(11) | | PRI | NULL| >auto_increment | >| start | timestamp(14) | YES | | >NULL|| >| stop | timestamp(14) | YES | | >NULL|| >| registrated| timestamp(14) | YES | | >NULL|| >| booking_object | int(11) | YES | MUL | >NULL|| >| booker | int(11) | YES | | >NULL|| >| price | text | YES | | >NULL|| >| part_payed | text | YES | | >NULL|| >++---+--+-+-++ >8 rows in set (0.00 sec) > >Best Greetings > >Sive > > > >- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail <[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Update change values in wrong column
mysqladmin version mysqladmin Ver 8.21 Distrib 3.23.42, for apple-darwin1.4 on powerpc Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Server version 3.23.42-log Protocol version10 Connection Localhost via UNIX socket UNIX socket /tmp/mysql.sock Uptime: 1 day 7 hours 15 min 46 sec Threads: 1 Questions: 436 Slow queries: 0 Opens: 93 Flush tables: 2 Open tables: 0 Queries per second avg: 0.004 Vendor Apple Blue&White G3 MacOS X 10.1.3 The included compiler in MacOSX Developer Tools gcc? THE ERROR See what happens in the start column, it change ?? when updating price column mysql> SELECT * FROM bookings; ++++++ +---++ | id | start | stop | registrated| booking_object | booker | price | part_payed | ++++++ +---++ | 1 | 20020324184014 | 20020321045959 | 20020323022729 | 1 | 1 | NULL | NULL | | 2 | 20020324184014 | 20020330055959 | 20020324171150 | 1 | 1 | NULL | NULL | ++++++ +---++ 2 rows in set (0.00 sec) mysql> UPDATE bookings SET price='0'; Query OK, 2 rows affected (0.01 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysql> SELECT * FROM bookings; ++++++ +---++ | id | start | stop | registrated| booking_object | booker | price | part_payed | ++++++ +---++ | 1 | 20020324184136 | 20020321045959 | 20020323022729 | 1 | 1 | 0 | NULL | | 2 | 20020324184136 | 20020330055959 | 20020324171150 | 1 | 1 | 0 | NULL | ++++++ +---++ 2 rows in set (0.00 sec) mysql> desc bookings; ++---+--+-+-++ | Field | Type | Null | Key | Default | Extra | ++---+--+-+-++ | id | int(11) | | PRI | NULL| auto_increment | | start | timestamp(14) | YES | | NULL|| | stop | timestamp(14) | YES | | NULL|| | registrated| timestamp(14) | YES | | NULL|| | booking_object | int(11) | YES | MUL | NULL|| | booker | int(11) | YES | | NULL|| | price | text | YES | | NULL|| | part_payed | text | YES | | NULL|| ++---+--+-+-++ 8 rows in set (0.00 sec) Best Greetings Sive - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php