© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•6mo ago•
4 replies
nemesis

Supabase: .order() not working on joined table column

Hi everyone, I have the following tables:

table public.buildings (
id uuid not null default extensions.uuid_generate_v4 (),
name character varying(255) not null,
is_active boolean not null default true,
...,
updated_at timestamp with time zone null,
constraint buildings_pkey primary key (id),
constraint buildings_company_id_fkey foreign key (company_id) references companies (id) on delete cascade
);

create table public.equipments (
id uuid not null default extensions.uuid_generate_v4 (),
name character varying not null,
buildings_id uuid null,
...,
warranty_expiration date null,
constraint equipments_pkey primary key (id),
constraint equipments_company_id_fkey foreign key (company_id) references companies (id),
constraint equipments_location_id_fkey foreign key (buildings_id) references buildings (id)
) tablespace pg_default;

In a React application I’m running the following query:

query = supabase
.from("equipments")
.select("*, buildings!inner(name)")
.eq("company_id", "20ebc2a2-7dcc...")
.order("name", { referencedTable: "buildings", ascending: true, nullsFirst: false });

The query runs without error, but the .order() doesn’t seem to work.

I also tried:
.order("name", { referencedTable: "equipments_location_id_fkey", ascending: true, nullsFirst: false });

.order("buildings.name", { ascending: true});

And that didn’t work either... What can I do?
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

Change table column order
SupabaseSSupabase / help-and-questions
4y ago
Deleted Column -> Table not working anymore
SupabaseSSupabase / help-and-questions
3y ago
How to use .or() filter with joined table columns in Supabase?
SupabaseSSupabase / help-and-questions
4mo ago
How to filter on joined table
SupabaseSSupabase / help-and-questions
4y ago