Traversing many to many relationships with sorting and filtering based on the related table.

In my project I have the following tables:

events: { id: number name: string description: string | null start_time: string end_time: string | null } hosts { id: number name: string bio: string | null } event_hosts: { event_id: number host_id: number }

Each event can have multiple hosts and vica versa.

I'd like to get all the events associated with a given host id, filter them so that only future events are shown and also order them by their starting date.

Is this possible somehow with the queries API? I couldn't figure out how to do it that way.

And if not what would be the elegant way to run a query like this?
Was this page helpful?