© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
6 replies
hellflur

SQL to Supabase query

Apologies if this has already been answered. I could not work out how to do this.

I'm trying to query a category by its slug and return the associated articles in the category. I have a join table categories_articles that contains an id (id of the category) and item (id of the article)

The following SQL query works:
SELECT a.*
FROM articles a
INNER JOIN categories_articles ca ON a.id = CAST(ca.item AS INTEGER)
INNER JOIN categories c ON ca.categories_id = c.id
WHERE c.slug = 'the-category-slug';
SELECT a.*
FROM articles a
INNER JOIN categories_articles ca ON a.id = CAST(ca.item AS INTEGER)
INNER JOIN categories c ON ca.categories_id = c.id
WHERE c.slug = 'the-category-slug';


Any tips for how to do this with the Supabase API?
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

How to write out query with supabase sql
SupabaseSSupabase / help-and-questions
3y ago
SQL to supabase orm
SupabaseSSupabase / help-and-questions
3y ago
Get supabase project name using SQL query
SupabaseSSupabase / help-and-questions
4y ago
Compile SQL to Supabase DSL
SupabaseSSupabase / help-and-questions
6mo ago