© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
1 reply
urth

Limit the rows from inner joined table

Hi,

Is there a way to limit the amount of the records I can get from the joined table?

export async function getUserWithAllRelatons(username: string, supabase: SupabaseClient){
    let user = await supabase.from('users').select(`
    id,
    username,
    email,
    created_at,
    stats (
        *
    ),
    friends!friends_user_id_fkey (
        friend_id
    )
    `).eq('username', username).single()
    
    if(user.error){
        return null;
    }

    return user.data as Partial<User>;
}
export async function getUserWithAllRelatons(username: string, supabase: SupabaseClient){
    let user = await supabase.from('users').select(`
    id,
    username,
    email,
    created_at,
    stats (
        *
    ),
    friends!friends_user_id_fkey (
        friend_id
    )
    `).eq('username', username).single()
    
    if(user.error){
        return null;
    }

    return user.data as Partial<User>;
}


As a single user can have many friends, I would like to limit the amount of friends to lets say 50

{
username: ...
password:...
friends: [ Array with length < 50 ]
}

EDIT: I'm not sure if this is even possible... Thinking of adding additional field inside friends which would help me make the query.
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

number of rows limit in a single table
SupabaseSSupabase / help-and-questions
6mo ago
How do I aggregate multiple rows of a joined table in SQL?
SupabaseSSupabase / help-and-questions
4y ago
URGENT: Accidentally deleted all rows from a table
SupabaseSSupabase / help-and-questions
4mo ago
Why does rows are banishing from table users?
SupabaseSSupabase / help-and-questions
3y ago