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 ,
)
.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).
Was this page helpful?