| | |
Remove last chars
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jan 2009
Posts: 105
Reputation:
Solved Threads: 5
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.
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.
-1
#3 17 Days Ago
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!
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!
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jan 2009
Posts: 105
Reputation:
Solved Threads: 5
0
#4 17 Days Ago
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.
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.
![]() |
Similar Threads
- Removing chars from a string (C)
- Deleting selected text function broken? (C#)
- Remove characters from string C (C)
- string manipulation (C#)
- string manipulation (C#)
- please help me as soon as possible (C++)
- very new to programming and need help bad please (C++)
- Removing found chars from string (C)
- Searching in documents... (C++)
Other Threads in the MySQL Forum
- Previous Thread: What does mysql return when the selection doesnt exist?
- Next Thread: exclude
| Thread Tools | Search this Thread |
agplv3 alfresco api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization






