© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
5 replies
KoreyPeters

Can't seem to cross intermediary table

I apologize for my ignorance, but SQL is not my strong point.

My tables:
event {
    id: UUID
}

category: {
    id: int,
    name: text
}

criterion: {
    question: text
    category_id: FK -> category
}

event_category {
    event_id: FK -> event
    category_id: FK -> category
}
event {
    id: UUID
}

category: {
    id: int,
    name: text
}

criterion: {
    question: text
    category_id: FK -> category
}

event_category {
    event_id: FK -> event
    category_id: FK -> category
}

So, each category has various criteria. And an event can have various categories. What I can't seem to do is answer the question: "For this event, what are all the criteria that apply?"

This is what I have so far. I can get to the category, but I can't get across the intermediary table:
let { data, error, status } = await supabase
  .from('criterion')
  .select('category_id, question, category_id!inner(name)')
  .eq('category_id.name', 'Event');
let { data, error, status } = await supabase
  .from('criterion')
  .select('category_id, question, category_id!inner(name)')
  .eq('category_id.name', 'Event');

I know my from table needs to be criterion, and I know I need go to up from criterion to category (with an inner join, and I've made this happen). I know I also need to go across event_category, but I can't seem to work out the supabase query for that. If anyone could provide advice, it would be greatly appreciated.
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

Can't find my table
SupabaseSSupabase / help-and-questions
6mo ago
Can't seem to update timestamptz column with Dart API
SupabaseSSupabase / help-and-questions
3y ago
I can't seem to get test_otp to work in Supabase CLI
SupabaseSSupabase / help-and-questions
2mo ago
MCP can't modify name of table?
SupabaseSSupabase / help-and-questions
6mo ago