mysql - how to use a json array inside an IN -


i have table json column called related. i'm using store , array, , i'd use array inside in. how can this?

e.g. select * products id in (select related products id = 1);

and select related products returns [1,2,3]

you can use function

update 2: (tested):

select `id`, `related`  `products`      json_search((select `related` `products` `id` = 4) ,'one', `id`)              not null; 

see (updated): https://www.db-fiddle.com/f/5esh1x9qjb46gazg6dkdfj/1

see also:

https://benjaminlistwon.com/blog/working-with-json-data-in-mysql-part-1-of-3/


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -