Group By & Aggregate REST to GraphQL API Integration
Views can be used to expose the results of a custom query as a virtual table.
Sometimes we might want to fetch some data derived by aggregating (avg, min, max, etc.) over a group of rows in a table.
This view will fetch the average article rating for each author across two tables.
- This schema is installable through your Hasura Console
- The schema sharing source code is available: github.com/hasura/template-gallery/tree/main/postgres/views-group-aggregate
- The schema sharing source code was derived from the following tutorial: hasura.io/docs/latest/graphql/core/databases/postgres/schema/views.html#example-group-by-and-then-aggregate
Read more here: Source link