adding information to existing existing data

This is a discussion on adding information to existing existing data within the MySQL Database forums, part of the Database Forums category; I have a table (inventory) with field (item_no) and would like to add some information to the end of the ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-11-2008
Auddog
 
Posts: n/a
Default adding information to existing existing data

I have a table (inventory) with field (item_no) and would like to add some
information to the end of the existing data in the item_no field. In
example, item_no = 1234-01 would now be 1234-01(wp). I'm not quite sure
where to even start and I've never done anything like this and I have
several hundred items to update.


A


Reply With Quote
  #2 (permalink)  
Old 01-11-2008
J.O. Aho
 
Posts: n/a
Default Re: adding information to existing existing data

Auddog wrote:
> I have a table (inventory) with field (item_no) and would like to add some
> information to the end of the existing data in the item_no field. In
> example, item_no = 1234-01 would now be 1234-01(wp). I'm not quite sure
> where to even start and I've never done anything like this and I have
> several hundred items to update.


UPDATE table SET item_no=concat(item_no,'(wp)') WHERE item_no='1234-01';

--

//Aho
Reply With Quote
  #3 (permalink)  
Old 01-11-2008
Peter H. Coffin
 
Posts: n/a
Default Re: adding information to existing existing data

On Fri, 11 Jan 2008 20:23:35 +0100, J.O. Aho wrote:
> Auddog wrote:
>> I have a table (inventory) with field (item_no) and would like to add some
>> information to the end of the existing data in the item_no field. In
>> example, item_no = 1234-01 would now be 1234-01(wp). I'm not quite sure
>> where to even start and I've never done anything like this and I have
>> several hundred items to update.

>
> UPDATE table SET item_no=concat(item_no,'(wp)') WHERE item_no='1234-01';
>


Not that the WHERE clause doesn't have to be there, or can be based on
any other selection criteria you like, like a LIKE for part numbers
(WHERE item_no LIKE '123%') or even on a non-item_no column (maybe a
manufacturer), or omitted altogether.

--
45. I will make sure I have a clear understanding of who is responsible for
what in my organization. For example, if my general screws up I will not
draw my weapon, point it at him, say "And here is the price for failure,"
then suddenly turn and kill some random underling. --Evil Overlord List
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:29 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0