开发者

MySQL populating a new field from parts of existing fields

I have a few fields holding paths to images. I now want to add another field holding the image name. How can I extract the file name from the full path from another field and update the name into th开发者_运维百科e new field?

this is how i want it to look:

fields:

image_thumbnail | image_name

values:

http://mysite.com/images/thumbnail/1234.jpg | 1234.jpg

note: image names may have different file extensions


UPDATE your_table
   SET image_name = SUBSTRING_INDEX(image_thumbnail, '/', -1)
     ;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜