© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
5 replies
draco

foreign key select query question

Example schema
People
id: 1, name: Steve , age: 43
id: 2, name: Janet, age:25

Interests 
id: 1, category: hiking, people: [1,2]
People
id: 1, name: Steve , age: 43
id: 2, name: Janet, age:25

Interests 
id: 1, category: hiking, people: [1,2]


So given this kind of structure, I am trying to figure out how to do a select from interests, but have the return data include the full information of each person in the list of people id instead of just the id themselves..

I know that you can use a join to accomplish this, but have had no success when trying to build a sql query using the dashboard or using the js library. It’s clearly user error on my part as I am still learning how to structure queries so any pointers would help.

I am trying to avoid the alternative of making multiple calls for each person id after I select the interest row since that seems inefficient.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Composite key foreign key issue
SupabaseSSupabase / help-and-questions
6mo ago
Limit on foreign table to filter select query?
SupabaseSSupabase / help-and-questions
4y ago
violates foreign key constraint
SupabaseSSupabase / help-and-questions
4y ago
Foreign Key Array Columns
SupabaseSSupabase / help-and-questions
4y ago