© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•6mo ago•
3 replies
Daniel Gomes-Sebastiao

Question about supabase-js client capabilities

Hey everyone, I am trying to crack the syntax for a query using the supabase-js client.

I am trying to replicate this query:

SELECT COUNT(*) as invoice_count
FROM invoices i
JOIN customers c ON i.customer_id = c.id
WHERE c.name ILIKE '%delba%';

My attempts have got me to:
const { count, error } = await supabase.from('invoices').select(
      `customers (
        name
      )
        `, { count: 'exact' })
      .ilike('customers.name', `%delba%`);
const { count, error } = await supabase.from('invoices').select(
      `customers (
        name
      )
        `, { count: 'exact' })
      .ilike('customers.name', `%delba%`);


The problem seems to be that the count is not factoring in the ilike condition at the end of the function. It always returns the full amount of rows in the invoice table, as if the ilike is not considered at all.

Am I doing this right? There are a number of other ways to do it, e.g. running multiple queries, counting the results after the fact, etc... But I am trying to get this right purely with the JS client to keep things from sprawling in different styles and methods.

How can we accomplish this with the js client?
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

Question about Supabase gotrue-js lock warning
SupabaseSSupabase / help-and-questions
3w ago
Supabase JS query question
SupabaseSSupabase / help-and-questions
13mo ago
Question about supabase oauth in mobile.
SupabaseSSupabase / help-and-questions
4y ago
Question on Supavisor with js client.
SupabaseSSupabase / help-and-questions
3y ago