I have json data in my table which contains again json value like below sample data
This is laravel audits, audits table new_values
column ( type: text ) record
but for this particular case I am not using eloquent or query builder, it is just a raw query
{"video_status_ids":"[6, 8, 14, 29]"}
now I want to check if this has 8 in it.
I tried
select * from audits WHERE JSON_CONTAINS(new_values, '8', '$.video_status_ids')
and
JSON_CONTAINS(audits.new_values, CAST(' . $status . ' AS json), "$.video_status_ids")';
I tried json_Search
to
select * from audits WHERE JSON_SEARCH(new_values, 'all', '8', 'video_status_ids', '$[*]');
select * from audits WHERE JSON_SEARCH(new_values, 'all', '8', NULL, '$[video_status_ids.*]');
SELECT * FROM audits WHERE JSON_SEARCH(new_values, 'all', '8', NULL, '$.video_status_ids.*')
Getting 0 records
and some other queries, but could not get the expected result.
by refering this but I am getting 0 records on it.