ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseโ€ข3y agoโ€ข
4 replies
jdgamble555

filtering on child, but not select

I'm pulling a tag cloud, but I don't want to pull tags from posts that are not published. This works as expected:
    const { data, error: _error, count } = await supabase
        .from('tags')
        .select('*, post_tag!inner(posts!inner())', { count: 'exact' })
        .eq('post_tag.posts.status', 'published')
        .order('tag_count', { ascending: false });
    const { data, error: _error, count } = await supabase
        .from('tags')
        .select('*, post_tag!inner(posts!inner())', { count: 'exact' })
        .eq('post_tag.posts.status', 'published')
        .order('tag_count', { ascending: false });

However, I get an empty
post_tag
post_tag
, which I don't actually want to select:
  {
    tag_id: 'f15ca8b0-70ee-4096-aee0-eef4580827eb',
    name: 'Firebase',
    created_at: '2023-12-06T03:27:39.647512+00:00',
    updated_at: '2023-12-06T03:27:39.647512+00:00',
    post_tag: [ {}, {}, {}, {} ]
  },
  {
    tag_id: 'f15ca8b0-70ee-4096-aee0-eef4580827eb',
    name: 'Firebase',
    created_at: '2023-12-06T03:27:39.647512+00:00',
    updated_at: '2023-12-06T03:27:39.647512+00:00',
    post_tag: [ {}, {}, {}, {} ]
  },

Is there a way to filter by posts (where status = 'published'), without actually selecting the
post_tag
post_tag
. In sql, you do the join without selecting that column...

J
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

filtering on not selected column on aggregate solution
SupabaseSSupabase / help-and-questions
8mo ago
Filtering by last hour in select()
SupabaseSSupabase / help-and-questions
4y ago
Select returning empty array on project but query works on supabase site
SupabaseSSupabase / help-and-questions
5mo ago
login works on localhost but not on netlify
SupabaseSSupabase / help-and-questions
4y ago