Supabase Get rows and order by

Hi there,

I am using supabase to get latest 20 entries in a table but the result comes ordered by ID and I want the latest entries, so I need to order by ID, is it possible to do that ?


Hi @Rad, I think the sorting will be tricky using the default Supabase node. But since Supabase is built on PostgreSQL you could consider using n8n’s Postgres node here and write a custom SQL query.

You can find the required credentials directly in the Project Settings in Supabase under Database:

In n8n, you can then run a query such as SELECT * FROM users ORDER BY id DESC LIMIT 20; to fetch the last 20 rows from a users table sorted by id in descending order:

1 Like

Ah that’s a clever idea, definitely will try this, thanks a lot @MutedJam


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.