© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
7 replies
Sarcodo

Is there a way to run a select query linking a table and a view?

I have a view which is based on "table_2" which has a foreign key to "table_1" is there a way I can run a select query to join them from react?

Trying to run:
await supabase.from("table_1").select(
  id,
  ...columns,
  table_2 (
    table_2_id_col
    ...columns
  )
)
await supabase.from("table_1").select(
  id,
  ...columns,
  table_2 (
    table_2_id_col
    ...columns
  )
)

However I get an error "could not establish a relationship between table_1 and table_2".

Looking at this page: https://supabase.com/blog/postgresql-views it says that a view behaves like a typical table and you can join with it and stuff, but maybe that's only backend joins rather than through the select function in js?
Supabase
Postgres Views
Creating and using a view in PostgreSQL.
Postgres Views
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

Least taxing way to query and update a table field?
SupabaseSSupabase / help-and-questions
4y ago
Is there a way to query for id by email on supabase auth table?
SupabaseSSupabase / help-and-questions
4y ago
Using a view within a js API query to a table.
SupabaseSSupabase / help-and-questions
3y ago
Is it possible to Query-join a table and storage ?
SupabaseSSupabase / help-and-questions
3y ago