Is there any way to perform GROUP BY operation in GraphQL?

Viewed 11

I need to group data in a table by using a particular field in the table. And couldn't find GROUP BY feature in GraphQL. Is there any way to achieve that ?

Current Format : [ { "my_state":"karnatak", "from_state":"kerala", "route":"wayanad" }, { "my_state":"karnatak", "from_state":"kerala", "route":"Mangalore" }, { "my_state":"karnatak", "from_state":"kerala", "route":"Palakkad" }, { "my_state":"karnatak", "from_state":"tamilnadu", "route":"hosure" }, { "my_state":"karnatak", "from_state":"tamilnadu", "route":"selam" }, { "my_state":"karnatak", "from_state":"tamilnadu", "route":"chennai" } ]

Required Format:

from_state: "karnatak",
      route: [
        {
          route: "chennai"
        },
        {
          route: "selam"

         },         ............       ]

0 Answers
Related