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
Post a Comment