How do I query two levels deep? For example here i...
# help
e
How do I query two levels deep? For example here is a select:
Copy code
.from('reviews')
.select('*, profile:user_id(*)')
which works fine. However, I want to also get a relation from the profile table, which has followers. Something like this:
Copy code
.from('reviews')
.select('*, profile:user_id(*, follows:follower_id(*))')
Where follower_id is the ID that a "follow" object has which relates to the id of a "follow" to the "profile" table. I want to be able to use this "follows" object in the filtering of the query later. Does this question make sense? Sorry my SQL skills are weak, still learning. I've read the docs through for what it's worth and couldn't figure this one out.. Thank you!
g
You should be able to do that with the correct syntax. Here is a thread with examples of multi level selects on foreign keys: https://github.com/supabase/supabase/discussions/1682 I've not tried it though.
e
I think my confusion begins when I have multiple many-to-many relationships between two tables, with multiple join tables
I see no discussion on this link or anywhere else about how to query in that scneario