1

我从 Supabase 开始,想了解如何SUM()SELECT.

我注意到COUNT我们使用:

const { data, error, range, count } = supabase
  .from('table')
  .select('*', { count: 'exact' })

有没有类似的东西SUM我没有注意到?

我的查询是这样的:

select
  "GE_PRODUCTS",
  sum("GE_QUANTITY") as Quantity,
  sum("GE_SALEVALUE") as Revenue
from "GE_SELLS"
where "GE_ENTERPRISE" = 'G.E.'
  and "DELETED" <> '*'
group by "GE_PRODUCTS"
order by Revenue desc
limit 3;
4

1 回答 1

1

您最好的选择是将其放入PostgreSQL 函数中,并使用以下命令从 Supabase 调用它.rpc()

于 2021-10-14T16:31:52.077 回答