I have a column in a table that contains some number offsets like this:
my_offsets
[1,2,10,11,111,112]
I want query this rows for search value 11 in [1,2,10,11,111,112]
. How can I do in SQL(mysql)?
I have a column in a table that contains some number offsets like this:
my_offsets
[1,2,10,11,111,112]
I want query this rows for search value 11 in [1,2,10,11,111,112]
. How can I do in SQL(mysql)?
if data is table
SELECT my_offsets
FROM my_tab
WHERE my_offsets='11'
if data is JSON
SELECT * from my_table
WHERE JSON_CONTAINS(yur_data, '11', '$');
example
JSON_CONTAINS('[1,2,3]','3','$') Returns: 1
JSON_CONTAINS('[1,2,3]','7','$') Returns: 0