Serialize field in SQL condition and compare greater than

Multi tool use


Serialize field in SQL condition and compare greater than
I have two dates in serialized field in my DB . That filed looks like
a:2:{i:0;s:8:"20180801";i:1;s:8:"20180808";}
a:2:{i:0;s:8:"20180801";i:1;s:8:"20180808";}
My important variable looks like $data = $_GET['DATA'];
$data = $_GET['DATA'];
Now I want get all post where $data is between dates in serialize field.
For example:
If $data = 20180805
my query should find post with that field
$data = 20180805
a:2:{i:0;s:8:"20180801";i:1;s:8:"20180808";}
a:2:{i:0;s:8:"20180801";i:1;s:8:"20180808";}
My query looks like:
$test2 = $wpdb->get_results("
SELECT DISTINCT post_id
FROM wp_postmeta
WHERE meta_value >= '$data'
AND meta_value <= '$data'
", ARRAY_A);
If it help I use ACF repeater field
Thanks in advance :)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.