I have two Sections on my site: Country and Alert. The Alert section has a relation with Country via an "Entries" field. An Alert represents something that is happening in a particular country for a period of time so it will have a post date and an expiry date.
In my template, I want to show a list of the 5 Countries that have currently active Alerts (ideally ordered by the country with the latest Alert).
I'm not sure how query across relationships in Craft (outside of using the
relatedTo query, but that only allows you to related to one entry, not a number of entries)? It seems all relationships are handled in a separate
relation table in the DB.
How can I achieve an query such as this within a Craft template?