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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -