I had similar.
If you look at the below:
$rows = $wpdb->get_results($wpdb->prepare( " SELECT * FROM wp_postmeta WHERE meta_key LIKE %s AND meta_value LIKE %s GROUP BY meta_value ASC", 'dates_%_available_dates', ''.$year.''.$month.'%', "" ));
You can see that dates_%_available_dates is the repeater field as it went:
Using the % allows you to be more dynamic, as you can search on all with the LIKE statement
It may help you with your code. I most certainly think rewriting your query to something like my example or the one in the link will help though
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.