Filtering on many-to-many relationship with join table #1080
-
Hey folks! I have a question related to this discussion here and figured I'd break it out into it's own post. Basically, I'm using @kiwicopple 's suggestion to create a "join" table to implement a many-to-many relationship. Here's the sample schema in question:
How do I construct a query with the Supabase JS API to query for all users that are members of team 1? Or members of team 1 and team 2? So far, I've tried something like the following:
But that returns something like:
Does anyone know how to construct a query such that John wouldn't be included in the results in the example above? I'm asking because I currently have to filter the result list client-side and would ideally like to avoid having to do that. Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey @pranavbadami,
Sorry, this is a current limitation: PostgREST/postgrest#1075. Filtering client-side is the simplest workaround for now. I'll start working on that one soon. |
Beta Was this translation helpful? Give feedback.
-
In the meantime, could you create a view or stored procedure? Then you can use |
Beta Was this translation helpful? Give feedback.
Hey @pranavbadami,
Sorry, this is a current limitation: PostgREST/postgrest#1075. Filtering client-side is the simplest workaround for now.
I'll start working on that one soon.