Welcome to WebmasterWorld Guest from 54.144.39.205

Forum Moderators: open

Message Too Old, No Replies

Query to delete some characters from a column

or how to remove parts of a string

     
1:33 pm on Nov 15, 2011 (gmt 0)

New User

10+ Year Member

joined:June 25, 2005
posts: 3
votes: 0


I search for an answer but couldnīt find one that work.

I have a column on a table with thousands of lines with values like:

brazili-world-v16-001
europea-beati-v16-002
america-lands-v16-003
jamaica-miste-v16-004
... and so on

And I need to delete everything after -v16-, including the "-v16-".

Is it possible to do that in phpMyAdmin?
1:59 pm on Nov 15, 2011 (gmt 0)

New User

5+ Year Member

joined:Oct 26, 2011
posts: 13
votes: 0


see documentation for substring_index function
[dev.mysql.com...]

select substring_index(your_field,'-',2)
from your_table

update your_table set your_field=substring_index(your_field,'-',2)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members