0

My json is of the format ["a","b","c"]. I want to write a sql query such that

select *
from mytable
where a_column in json_extract["a","b","c"]

This logic does not work, because json_extract needs a path.

Is there any work around for this in mysql 8.0

1 Answer 1

1
SELECT *
FROM mytable
WHERE JSON_CONTAINS('["a","b","c"]', JSON_QUOTE(a_column));

I assume that the column a_column is a string-type column which contains a value like 'a'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.