MySQL Forums
Forum List  »  General

Multiple Update Question
Posted by: Vijay Ramesh
Date: April 12, 2005 01:45PM

I have a table called tblFileObjects - and a field in this table called chrFileObjectRelativeURL. Since the initial creation of this site, we have decided to change the structure a bit - and this has included shifting where files are stored. Now I have a lot of entries in tblFileObjects that all need the same change done to them - namely, adding a /content/ to the begining of their chrFileObjectRelativeURL field. For example -

mysql> select * from tblFileObjects where pkeyFileObjectID= 25;
+------------------+---------------------------+------------------------+--------------------------+-----------------------+-----------------------+----------------------------+-----------------------+-----------------------+---------------------+------------------------------------------------+----------------------------------------------------------+---------------------------+
| pkeyFileObjectID | fkeyFileObjectCreatedByID | chrFileObjectFileTitle | txtFileObjectDescription | txtFileObjectKeywords | chrFileObjectFileType | chrFileObjectFileExtension | chrFileObjectFileName | chrFileObjectFileSize | chrFileObjectFolder | chrFileObjectPath | chrFileObjectURL | chrFileObjectRelativeURL |
+------------------+---------------------------+------------------------+--------------------------+-----------------------+-----------------------+----------------------------+-----------------------+-----------------------+---------------------+------------------------------------------------+----------------------------------------------------------+---------------------------+
| 25 | 4 | icon1 | bullet icon # 1 | | icon | gif | icon1.gif | 211 | /forums | /home/sites/ccweb/web/files/4/forums/icon1.gif | http:// ccweb.pinkfloydland.net/files/4/forums/icon1.gif | /files/4/forums/icon1.gif |
+------------------+---------------------------+------------------------+--------------------------+-----------------------+-----------------------+----------------------------+-----------------------+-----------------------+---------------------+------------------------------------------------+----------------------------------------------------------+---------------------------+
1 row in set (0.00 sec)

here - /files/4/forums/icon1.gif needs to be updated to /content/files/4/forums/icon1.gif.

I was wondering if there was anyway to do an "add" to every entry in tblFileObjects - I can't just do a massive update, because they all have different chrFileObjectRelativeURL values - but can I do something like -

update tblFileObjects set chrFileObjectRelativeURL="/content" . chrFileObjectRelativeURL

or?

I'm not sure if this is possible, or what the exact syntax would be - but if anybody can help clarify this, it would save a hell of a lot of time, not having to do all the updates one by one!

Thanks!

Options: ReplyQuote


Subject
Written By
Posted
Multiple Update Question
April 12, 2005 01:45PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.