© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago
Bat Lamjav

Joining 3 tables

Hi all.

I'm trying to make a query to a bookings table which fk references a post table, which fk references a user table.

I want to select from the bookings table the post row as well as the info about the author of the post. How can I do this in a single query?

This is what I have so far:

const query = supabase
.from("bookings")
.select(

        id,
        post_details: driver_posts (*)
        rider_id
      

        id,
        post_details: driver_posts (*)
        rider_id
      
,
)
.eq("rider_id", user?.id)
.eq("status", "REQUESTED")

This selects the referenced post but I also want to select from the profiles table joining on the post_details.user_id field (not rider_id).
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

RPC that return result of joining to tables
SupabaseSSupabase / help-and-questions
4y ago
Tables In Tables?
SupabaseSSupabase / help-and-questions
4y ago
Lost tables
SupabaseSSupabase / help-and-questions
4mo ago
Tables wiped
SupabaseSSupabase / help-and-questions
5mo ago