pg_graphql icon indicating copy to clipboard operation
pg_graphql copied to clipboard

Support orderBy aggregates based on child tables

Open bossjapzz opened this issue 4 years ago • 4 comments

Describe the bug Support orderBy aggregates based on child tables

To Reproduce Steps to reproduce the behavior:

  1. just add order by to your query but you don't have an option to order by related tables (child table)

Expected behavior Based from hasura Screen Shot 2022-02-21 at 3 49 23 PM

bossjapzz avatar Feb 21 '22 08:02 bossjapzz

The most common operations are: count, max, min Screen Shot 2022-02-21 at 4 52 39 PM

bossjapzz avatar Feb 21 '22 08:02 bossjapzz

other operations aside from: standard deviation and variance is: avg, sum Screen Shot 2022-02-21 at 4 58 27 PM

bossjapzz avatar Feb 21 '22 09:02 bossjapzz

Another example is ordering POSTS by REACTIONS count

query MyQuery {
  GroupContent_connection(order_by: {GroupContentReactions_aggregate: {count: desc}}) {
    edges {
      node {
        id
        GroupContentReactions_aggregate {
          aggregate {
            count
          }
        }
      }
    }
  }
}

bossjapzz avatar Feb 21 '22 11:02 bossjapzz

Hasura compatibility would be really wonderful.

cpursley avatar Jun 19 '22 19:06 cpursley