Replace String in Mysql

Asked

Viewed 105 times

1

I’m doing a query in a table. The field filiais returns the following value

["005","001"]

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

['005','001']

With the simple quotes

My query

SELECT * FROM bancos WHERE ativo=1
  • ['005','001'] already is the raw value returned by query, right?

1 answer

2


Use the function REPLACE mysql:

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.