If you need to order the events based on the date in a repeater, then you need to query the repeater instead of the events. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/querying-the-database-for-repeater-sub-field-values/.
You also need to select the field values based on the current time and remove the duplicated post ID. This page should give you more idea about it: http://stackoverflow.com/questions/4682621/sql-how-to-select-rows-from-a-table-while-ignoring-the-duplicate-field-values.
If you need more help to create the SQL query, please visit WordPress and MySQL community.
I hope this helps 🙂
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.