How to run an aggregate query in supabase JS
In the docs, it mentions that we can make select queries in JavaScript.
However, I want to run an aggregate query to fetch the total credits of an organization along with its id, name, and other details.
I have the following SQL function for calculating the total credits:
But how can I retrieve the organization details (id, name, etc.) along with the remaining credits in a single query?
Here are my table definitions for reference:
I tried the following, but it doesn't work:
However, I want to run an aggregate query to fetch the total credits of an organization along with its id, name, and other details.
I have the following SQL function for calculating the total credits:
But how can I retrieve the organization details (id, name, etc.) along with the remaining credits in a single query?
Here are my table definitions for reference:
I tried the following, but it doesn't work: