© 2026 Hedgehog Software, LLC

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

how to get single item in join query

I have a query below that gets the items associated with a list.
  return client
    .from(LISTS_TABLE)
    .select(
      `
        id,
        name,
        listItems: list_items!list_id (
        status
      )
      `,
    )
    .eq('id', id)
    .single();
  return client
    .from(LISTS_TABLE)
    .select(
      `
        id,
        name,
        listItems: list_items!list_id (
        status
      )
      `,
    )
    .eq('id', id)
    .single();


But let's say that
list_items
list_items
has a 1 to 1 relationship with
lists
lists
. how can I modify the query to get a single item from the
list_items
list_items
table? The code above works, but it will return an array of list items when i want it to just be the object because it is a 1 to 1 relationship.
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 make join query like
SupabaseSSupabase / help-and-questions
3y ago
How to query data using a join table?
SupabaseSSupabase / help-and-questions
4y ago
JS inner join match single row?
SupabaseSSupabase / help-and-questions
4y ago
Understanding how to create a join in JavaScript
SupabaseSSupabase / help-and-questions
4y ago