0

Hello all, i would like to know how it is possible to remove for example last 20 characters, or by specifing the string to remove.
For example i have 2 rows (in reality there are more than 100, thats why im not working it out by hand) with the next content:
insert into abc (1,"hello <b>b</b>lol");
insert into abc(2,"bye <b>a</b>lol");
i would like to remove 3 last characters or the string "lol".
Thanks in advance.
Have a good day.

2
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by nav33n
0

Dont know why cant i edit the post,
but the querrys arent right, they should be :
insert into abc(id,text) values(1,"hello <b>b</b>lol");
insert into abc(id,text) values(2,"bye <b>a</b>lol");

-1

Hi, can you elaborate your question ?
If you are inserting the value to the table from php, you can use substr to insert only a part of a string. If you are directly inserting the record to the table, you can use mysql's substring function.
If this solves your problem, well and good.. If it doesn't, please explain your question in detail.
P.S you can only edit your post within 30 mins of posting! :)

Cheers!

0

Thanks for response, i've found what i was looking for, and it was mysql's replace function =).
What i neded to do was to remove part of the data in a row that repeated itself once for a row and many times for a column.
so i just neded to use next:
update abc set text=replace(text,'lol','NOTLOL') where 1;
and it would do what i neded.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.