just a small hint for folks struggling with relations and stored procedures and stuff. This solved some huge issues for me.
You can do subqueries within the filter query parameter like
id IN (SELECT id FROM table WHERE column = "value")
or in the request uri: