Re: Update Doesn't Update!
On Fri, 11 Dec 2009 04:38:01 -0500, Victor Subervi victorsube...@gmail.com wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Warnings: 1 do a SHOW WARNINGS immediately after you execute the stmt. / Carsten mysql select sizes, colorsShadesNumbersShort from products where ID=0; +---+--+ | sizes | colorsShadesNumbersShort | +---+--+ | | | +---+--+ 1 row in set (0.00 sec) Huh? TIA, Victor !DSPAM:451,4b221339930275276717544! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Update Doesn't Update!
On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Look at the message, 0 rows changed and 1 warning. You cannot have ID=0 if ID is an index. -- Jørn Dahl-Stamnes homepage: http://www.dahl-stamnes.net/dahls/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Update Doesn't Update!
On Fri, Dec 11, 2009 at 4:48 AM, Jørn Dahl-Stamnes sq...@dahl-stamnes.netwrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Look at the message, 0 rows changed and 1 warning. You cannot have ID=0 if ID is an index. Yikes! Then how do I update this table? I will need to update every variable *except* the ID, which is the primary key and an auto_increment. V
Re: Update Doesn't Update!
On Fri, Dec 11, 2009 at 4:48 AM, Jørn Dahl-Stamnes sq...@dahl-stamnes.netwrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Look at the message, 0 rows changed and 1 warning. You cannot have ID=0 if ID is an index. Yikes! Then how do I update this table? I will need to update every variable *except* the ID, which is the primary key and an auto_increment. V
Re: Update Doesn't Update!
mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Look at the message, 0 rows changed and 1 warning. You cannot have ID=0 if ID is an index. Are you serious?? With regards, Martijn Tonies Upscene Productions http://www.upscene.com Download Database Workbench for Oracle, MS SQL Server, Sybase SQL Anywhere, MySQL, InterBase, NexusDB and Firebird! Database questions? Check the forum: http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
RE: Update Doesn't Update!
If ID column is primary key and auto increment as you said, it cant be equal to zero. You got a query which reads: UPDATE columns WHERE false There is no chance for any updates. http://dev.mysql.com/doc/refman/5.0/en/update.html Regards, m -Original Message- From: Victor Subervi [mailto:victorsube...@gmail.com] Sent: 11 December 2009 10:06 Cc: mysql@lists.mysql.com Subject: Re: Update Doesn't Update! On Fri, Dec 11, 2009 at 4:48 AM, Jørn Dahl-Stamnes sq...@dahl-stamnes.netwrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Look at the message, 0 rows changed and 1 warning. You cannot have ID=0 if ID is an index. Yikes! Then how do I update this table? I will need to update every variable *except* the ID, which is the primary key and an auto_increment. V -- Szef przynudza? Zagraj sobie! Sprawdz http://link.interia.pl/f24e4 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Update Doesn't Update!
On Fri, Dec 11, 2009 at 4:43 AM, cars...@bitbybit.dk wrote: On Fri, 11 Dec 2009 04:38:01 -0500, Victor Subervi victorsube...@gmail.com wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Warnings: 1 do a SHOW WARNINGS immediately after you execute the stmt. mysql update products set sizes=('Small', 'Large') where SKU='prodSKU1'; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql show warnings; +-+--++ | Level | Code | Message| +-+--++ | Warning | 1265 | Data truncated for column 'sizes' at row 1 | +-+--++ 1 row in set (0.00 sec) What do? How do I enter multiple values? TIA, V
Re: Update Doesn't Update!
On Fri, 11 Dec 2009 10:48:59 +0100, Jørn Dahl-Stamnes sq...@dahl-stamnes.net wrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Look at the message, 0 rows changed and 1 warning. You cannot have ID=0 if ID is an index. Then how did he manage to get a matched row? Of course you can have ID=0. / Carsten -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Update Doesn't Update!
On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi victorsube...@gmail.com wrote: mysql update products set sizes=('Small', 'Large') where SKU='prodSKU1'; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql show warnings; +-+--++ | Level | Code | Message| +-+--++ | Warning | 1265 | Data truncated for column 'sizes' at row 1 | +-+--++ 1 row in set (0.00 sec) What do? How do I enter multiple values? Impossible to say, until you let us know how you defined the column in the first place... / Carsten -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Update Doesn't Update!
Jørn Dahl-Stamnes wrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Look at the message, 0 rows changed and 1 warning. You cannot have ID=0 if ID is an index. You can, but not if it's an auto-increment field. Mark -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Update Doesn't Update!
first desc products or try to update products set sizes='Small' where SKU='prodSKU1'; Best Regards! Yang Wang Tel.: 0769-21687397 Fax.: 0769-21685577 Email: yw...@lfm-agile.com.hk - Original Message - From: cars...@bitbybit.dk To: Victor Subervi victorsube...@gmail.com Cc: mysql@lists.mysql.com Sent: Friday, December 11, 2009 6:13 PM Subject: Re: Update Doesn't Update! On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi victorsube...@gmail.com wrote: mysql update products set sizes=('Small', 'Large') where SKU='prodSKU1'; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql show warnings; +-+--++ | Level | Code | Message| +-+--++ | Warning | 1265 | Data truncated for column 'sizes' at row 1 | +-+--++ 1 row in set (0.00 sec) What do? How do I enter multiple values? Impossible to say, until you let us know how you defined the column in the first place... / Carsten -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=yw...@lfm-agile.com.hk
Re: Update Doesn't Update!
Quoting cars...@bitbybit.dk: Of course you can have ID=0. Definately agree mysql DESCRIBE test; +-+-+--+-+-++ | Field | Type| Null | Key | Default | Extra | +-+-+--+-+-++ | autoinc | int(11) | NO | PRI | NULL| auto_increment | | value | varchar(10) | NO | | NULL|| +-+-+--+-+-++ 2 rows in set (0.00 sec) mysql SELECT * FROM test; +-++ | autoinc | value | +-++ | 0 | 1234567890 | +-++ 1 row in set (0.00 sec) mysql UPDATE test SET value='a' WHERE autoinc='0'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql SELECT * FROM test; +-+---+ | autoinc | value | +-+---+ | 0 | a | +-+---+ 1 row in set (0.00 sec) However, what I believe the problem is: mysql UPDATE test set value='12345678901' WHERE autoinc='0'; Query OK, 1 row affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql SELECT * FROM test; +-++ | autoinc | value | +-++ | 0 | 1234567890 | +-++ 1 row in set (0.00 sec) the value of value is too long for the varchar(10) in the table. It thus generates the warning, and truncate the field. The poster's table needs to be updated therefor to accept longer variables in the sizes column. -- Regards, Chris. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Update Doesn't Update!
On Fri, Dec 11, 2009 at 5:13 AM, cars...@bitbybit.dk wrote: On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi victorsube...@gmail.com wrote: mysql update products set sizes=('Small', 'Large') where SKU='prodSKU1'; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql show warnings; +-+--++ | Level | Code | Message| +-+--++ | Warning | 1265 | Data truncated for column 'sizes' at row 1 | +-+--++ 1 row in set (0.00 sec) What do? How do I enter multiple values? Impossible to say, until you let us know how you defined the column in the first place... Sorry. It's an enum of which the elements I am trying to add into a row are elements of the same enum; that is, a subset. V
Re: Update Doesn't Update!
On Fri, 11 Dec 2009 05:28:41 -0500, Victor Subervi victorsube...@gmail.com wrote: On Fri, Dec 11, 2009 at 5:13 AM, cars...@bitbybit.dk wrote: On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi victorsube...@gmail.com wrote: mysql update products set sizes=('Small', 'Large') where SKU='prodSKU1'; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql show warnings; +-+--++ | Level | Code | Message| +-+--++ | Warning | 1265 | Data truncated for column 'sizes' at row 1 | +-+--++ 1 row in set (0.00 sec) What do? How do I enter multiple values? Impossible to say, until you let us know how you defined the column in the first place... Sorry. It's an enum of which the elements I am trying to add into a row are elements of the same enum; that is, a subset. You're using the wrong type. RTFM re. the difference between enums and sets. / Carsten -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Update Doesn't Update!
On Fri, Dec 11, 2009 at 5:33 AM, cars...@bitbybit.dk wrote: On Fri, 11 Dec 2009 05:28:41 -0500, Victor Subervi victorsube...@gmail.com wrote: On Fri, Dec 11, 2009 at 5:13 AM, cars...@bitbybit.dk wrote: On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi victorsube...@gmail.com wrote: mysql update products set sizes=('Small', 'Large') where SKU='prodSKU1'; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql show warnings; +-+--++ | Level | Code | Message| +-+--++ | Warning | 1265 | Data truncated for column 'sizes' at row 1 | +-+--++ 1 row in set (0.00 sec) What do? How do I enter multiple values? Impossible to say, until you let us know how you defined the column in the first place... Sorry. It's an enum of which the elements I am trying to add into a row are elements of the same enum; that is, a subset. You're using the wrong type. RTFM re. the difference between enums and sets. k. Thanks, V
Re: Update Doesn't Update!
On Fri, Dec 11, 2009 at 11:19 AM, Mark Goodge m...@good-stuff.co.uk wrote: Jørn Dahl-Stamnes wrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Look at the message, 0 rows changed and 1 warning. You cannot have ID=0 if ID is an index. You can, but not if it's an auto-increment field. Also, not *entirely* correct, although you have to jump through a few hoops: it can occur if the field was changed to auto_increment *after* the 0 was put in there. Yes, I inherited a database like that once, and yes, it fucks up your day. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=vegiv...@tuxera.be
Re: Update Doesn't Update!
On Fri, Dec 11, 2009 at 8:43 AM, Johan De Meersman vegiv...@tuxera.bewrote: On Fri, Dec 11, 2009 at 11:19 AM, Mark Goodge m...@good-stuff.co.uk wrote: Jørn Dahl-Stamnes wrote: On Friday 11 December 2009 10:38, Victor Subervi wrote: Hi; mysql update products set sizes=('Small', 'Large') where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 Look at the message, 0 rows changed and 1 warning. You cannot have ID=0 if ID is an index. You can, but not if it's an auto-increment field. Also, not *entirely* correct, although you have to jump through a few hoops: it can occur if the field was changed to auto_increment *after* the 0 was put in there. Yes, I inherited a database like that once, and yes, it fucks up your day. I'm lost. I set up this database originally with auto_increment and the first value was 0. I thought that was always the case. Is there a problem here? V
Re: Update Doesn't Update!
On Fri, Dec 11, 2009 at 6:40 PM, Victor Subervi victorsube...@gmail.comwrote: I'm lost. I set up this database originally with auto_increment and the first value was 0. I thought that was always the case. Is there a problem here? Yes, that should not have happened. For autoincrement fields, both NULL and 0 are magic values to get the next number from the sequence at insert time.