views:

28

answers:

1

Excuse my ignorance.

I need to replace all data in a mysql field before and including the first # .

example field = golfers

data at the first hole the golfer missed a 9 inch putt and said "#hit it bad

new data hit it bad

+1  A: 
update table set new_column_name = substring(column_name, instr(column_name, '#') + 1);
oedo
Gave me eveything but the # both before and after.----------------------------------------update content set metakey = substring(alias, instr(alias, '#') + 1)----------------------------------table = content , metakey is new field, alias is old field
John Snow
yep that should work fine. can you give me an example of what you got instead?
oedo
at the first hole the golfer missed a 9 inch putt and said "hit it bad
John Snow
and what do you get from `select substring('test#hello', instr('test#hello', '#') + 1);` - it should just return hello
oedo
My fault I used wrong colum with the # in it - worked perfectly
John Snow