| Index
» Projekty
» phpMyEdit
» Fórum
» Trimming MYSQL |
 |
kiddoo
Založený: 18.02.2009
Príspevky: 2
Zaslal: 2009-02-18 12:47
Návrat hore
Odpovedať s citátom
|
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
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-02-18 17:56
Návrat hore
Odpovedať s citátom
|
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.
| Kód: |
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
Založený: 18.02.2009
Príspevky: 2
Zaslal: 2009-02-21 09:41
Návrat hore
Odpovedať s citátom
|
Can't do that, I have over 500K records in this database. Looking rather for a solution on "select" statement rather than "update".
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-02-21 16:32
Návrat hore
Odpovedať s citátom
|
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
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|