A
A
Aljo2021-12-14 21:16:27
SQL
Aljo, 2021-12-14 21:16:27

How to get rid of quotes when concat and json_extract?

The request is the following:

SELECT concat(
    json_extract(additional,'$.surname'),
    json_extract(additional,'$.firsname'),
    json_extract(additional,'$.lastname')
)
FROM `user_attributes`


But in the end, the result is displayed in the following syntax:
"Петров""Петр""Петрович"

Please tell me, is it possible to remove quotes from the result?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava Rozhnev, 2021-12-14
@aljo222

JSON_UNQUOTE

SELECT concat(
    JSON_UNQUOTE(json_extract(additional,'$.surname')),
    JSON_UNQUOTE(json_extract(additional,'$.firsname')),
    JSON_UNQUOTE(json_extract(additional,'$.lastname'))
) fullname
FROM `user_attributes`
;

MySQL JSON_UNQUOTE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question