I am trying to get records where end date is smaller than today's date and id =14. But I am getting 0 result. How to find records from array ?
CREATE TABLE `test_udc` (
`id` int(10) NOT NULL,
`test_udc` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
) ;
INSERT INTO `test_udc` (`id`, `test_udc`) VALUES
(1, '[{\"id\":7,\"desc\":\"Be Alert\"},{\"id\":8,\"desc\":\"Dog - Phone Ahead\"},{\"id\":14,\"desc\":\"Self-Isolating CV19\",\"start_date\":\"04-02-2021\",\"end_date\":\"14-02-2021\"}]'),
(2, '[{\"id\":7,\"desc\":\"Be Alert\"},{\"id\":14,\"desc\":\"Self-Isolating CV19\",\"start_date\":\"04-02-2021\",\"end_date\":\"16-02-2021\"}]');
I have
SELECT * FROM `test_udc` where json_value(`test_udc`,'$.[*].id')='14' AND json_value(`test_udc`,'$.[*].end_date')<'2021-02-15'
idanddesccolumns instead of a JSON value.