Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Add new column and copy values to it from existing column

Quote Reply
Add new column and copy values to it from existing column
I want to add a new column to the category table and then copy corresponding category names in to that column as follows, how to do this with mysqlman or some other way:

1) If my category is for example, Main/Sub1/Sub2 then I want the row in the column to show "Sub2"
2) Taking this one step further, if possible I want to add a suffix to the end of each then category like so "Sub2-Sometext" ie. it will add Sometext to the end of each category that I copied into in the new column.

Thanks!
Quote Reply
Re: [socrates] Add new column and copy values to it from existing column In reply to
Hi,

Wouldn't that just be the "Name" field you already have? If so, just do:

Code:
UPDATE glinks_Category SET Field_Name = CONCAT(Name,"-SomeText")

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Add new column and copy values to it from existing column In reply to
Yes! Thanks!