sayicej101
sayicej101

Reputation: 85

How to search JSON array contains item in mysql

I have type images (json) in my db. Its array of strings.

How can I select all rows that images contains "foo" ?

enter image description here

Upvotes: 1

Views: 3342

Answers (1)

GMB
GMB

Reputation: 222432

Use json_contains():

select t.*
from mytable t
where json_contains(images, '"foo"')

Upvotes: 6

Related Questions