| Index
» Projects
» phpMyEdit
» Forum
» Trimming MYSQL |
 |
kiddoo
Joined: 18 Feb 2009
Posts: 2
Posted: 2009-02-18 12:47
Back to top
Reply with quote
|
Hello,
I have to remove unwanted strings from my columns and display only corrected fields. Examples:
1.
Grant Jeffrey 343682,ou=employee,o=KKT,c=AN
I want to keep full name, but remove "343682,ou=employee...."
2.
Jorge Arturo Castillo 199709,ou=employee,o=KKA,c=AT
Same story, would like to keep full name on listing but remove rest from displaying.
How I can do it?
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2009-02-18 17:56
Back to top
Reply with quote
|
It is somewhat dangerous to execute a MySQL RELPACE function, so always backup your data first, and make sure the backup file is good before proceeding with queries such as the following.
| Code: |
UPDATE `table_name` SET `column_name` =
REPLACE(`column_name`, 'old content', 'new content');
|
The SQL window in phpMyAdmin is generally the easiest way to implement such queries.
|
kiddoo
Joined: 18 Feb 2009
Posts: 2
Posted: 2009-02-21 09:41
Back to top
Reply with quote
|
Can't do that, I have over 500K records in this database. Looking rather for a solution on "select" statement rather than "update".
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2009-02-21 16:32
Back to top
Reply with quote
|
The replace function can be used with select. There are a lot of MySQL string functions ... maybe some combination of functions will produce the desired result:
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html
|
|
Post new topic
Reply to topic
|
|
|
|