|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi, I have a database I recently imported from a linux machine.
THis databse has a table named images, where a field pathname exists. The pathname is currently under the linux directory structure. It is also very strange because mysql decided to concat c:/documents and settings/my pictures to all the pathname values... So what I need is to remove that part of the string ("c:/documents and settings/my pictures") and replace it with "c:/www/apache2/" How would I go about doing this? I'm just having problems removing the substring. I can concat "c:/www/apache2/" without any problems. Thanks,, Itamar Levin |
|
#2
|
||||
|
||||
|
The following example should get you on the right path:
Code:
mysql> select * from strings; +-------------------------+ | val | +-------------------------+ | one two three four five | +-------------------------+ 1 row in set (0.00 sec) mysql> select SUBSTRING(val, 5, 10) from strings; +-----------------------+ | SUBSTRING(val, 5, 10) | +-----------------------+ | two three | +-----------------------+ 1 row in set (0.00 sec) mysql> update strings set val=SUBSTRING(val,5,10); Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from strings; +-----------+ | val | +-----------+ | two three | +-----------+ 1 row in set (0.00 sec)
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > updating fields in database. syntax help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|