© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
3 replies
jarrettsorensen

Aggregate functions are not allowed in WHERE

I'm getting an error in my query shown below when trying to filter to get only the transactions that have a single allocation related to them

  const { data, error } = await supabaseClient
    .from('transaction')
    .select('id, allocation(count)')
    .eq('allocation.count', 1);
  const { data, error } = await supabaseClient
    .from('transaction')
    .select('id, allocation(count)')
    .eq('allocation.count', 1);


I understand that this is not allowed for aggregate functions and that Postgres requires using the
HAVING
HAVING
clause instead of the
WHERE
WHERE
clause, but I don't know how to do that with the JS client. I looked through documentation, but couldn't find anything

Any help 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

where are RPC functions logs?
SupabaseSSupabase / help-and-questions
4mo ago
How to enable aggregate functions on self hosted supabase.
SupabaseSSupabase / help-and-questions
8mo ago
GraphQL Aggregate
SupabaseSSupabase / help-and-questions
6mo ago
Are Edge Functions Down?
SupabaseSSupabase / help-and-questions
4y ago