Use CONCAT().

SELECT CONCAT('/',your_field,'/') 'newData' FROM your_table.

Then use similar logic to do an UPDATE statement, i.e. UPDATE your_table SET 
your_field = CONCAT('/',your_field,'/')

You need to first make sure that the field you are trying to update is a 
VARCHAR, because as it stands, it looks as though you have that field as an INT.

J.R.

----------------------------------------
From: Matthew Stuart <[EMAIL PROTECTED]>
Sent: Thursday, January 03, 2008 12:55 PM
To: MySQL email support <mysql@lists.mysql.com>
Subject: I need to add to content somehow 

I have a DB that has a field in it that currently just holds single  
or double numbers - these numbers are basically a reference to a  
category in which the particular record should be displayed. However  
I have now been asked if I can make it so that a particular record  
can be displayed in more than one category.

All I need to do is somehow ask the field to add a forward slash to  
the front and end of the data, so the data will go from this:

1
33
21
9
11

to this:

/1/
/33/
/21/
/9/
/11/

How do I get MySQL to do this? I guess I might have to do it in two  
steps by firstly adding the slash to the front and then lastly to the  
back. But I have no idea on how to do it. My reason for doing this is  
so that I get the webpage to look for numbers that are between the  
slashes. this will enable me to have numbers like this: /1/33/9/  
enabling me to have a record in more than one category.

Any help would be appreciated.

Thanks

Mat

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


Reply via email to