Re: how to add to a set
Bob Hall writes: >>What I want to do is something like this...a set variable in a table >>has a current value of "a,b,c" and I want to add the value "d" to it >>so the new value is now "a,b,c,d". The type is already defined as >>setval SET ('a', 'b', 'c', 'd', 'e', 'f') >Ma'am, by variable, do you mean a column in a row? Try >UPDATE table_name SET column_name = Concat(column_name, ",d") WHERE ... This worked perfectly, thanks! --Cindy - 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
Re: how to add to a set
>OK, is there an easy way to ADD a value to a set type without having >to enumerate all that's there already? I've looked through >http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#SET > >but it doesn't say anything about adding values to the current set. >It rather looks like all or nothing, but I was hoping to avoid having >to retrieve the record via a select before doing the update. > >What I want to do is something like this...a set variable in a table >has a current value of "a,b,c" and I want to add the value "d" to it >so the new value is now "a,b,c,d". The type is already defined as >setval SET ('a', 'b', 'c', 'd', 'e', 'f') > > >Thanks, >--Cindy Ma'am, by variable, do you mean a column in a row? Try UPDATE table_name SET column_name = Concat(column_name, ",d") WHERE ... Bob Hall Know thyself? Absurd direction! Bubbles bear no introspection. -Khushhal Khan Khatak - 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
how to add to a set
OK, is there an easy way to ADD a value to a set type without having to enumerate all that's there already? I've looked through http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#SET but it doesn't say anything about adding values to the current set. It rather looks like all or nothing, but I was hoping to avoid having to retrieve the record via a select before doing the update. What I want to do is something like this...a set variable in a table has a current value of "a,b,c" and I want to add the value "d" to it so the new value is now "a,b,c,d". The type is already defined as setval SET ('a', 'b', 'c', 'd', 'e', 'f') Thanks, --Cindy -- [EMAIL PROTECTED] - 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