srinath madusanka srinath madusanka - 19 days ago 5
MySQL Question

mysql show select output replacing characters

I have some table with email filed, i want to get group of emails using group concat. no issue there

it give out put like following

test@domain.com,test2@domain.com ,test3@domain.com ,test4@domain.com


but i want to get result as following

test_domain.com,test2_domain.com ,test3_domain.com


I know this can be done using simple PHP explode but i want to know there is any way
to do that only using MYSQL..............

Answer

You could use the mysql replace string function around your group_concat:

 Select ...,replace(group_concat(...), '@','_'),...

See http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace