Replace String in MySql

1

I'm doing a query on a table. The filiais field returns the following value

["005","001"]

I wanted the query directly to transform this string (varchar) into:

['005','001']

With the single quotes

My query

SELECT * FROM bancos WHERE ativo=1
    
asked by anonymous 25.02.2015 / 17:07

1 answer

2

Use the REPLACE function of MySql:

SELECT REPLACE(filiais, "\"", "\'") FROM bancos WHERE ativo = 1

The first parameter is the column in which the function is executed, the second is the old character and the third is the new character.

    
25.02.2015 / 17:14