[英]Is there any way to perform GROUP BY operation in GraphQL?
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.
并且在 GraphQL 中找不到 GROUP BY 功能。 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"
},
............
]
GraphQL is a query language for APIs and it does not really "contain features" like GroupBy, Count, Sort, etc. Those features or queries have to be implemented in the server (GraphQL API) and it leaves you a couple of options: GraphQL 是一种API 查询语言,它并不真正“包含特性”,如 GroupBy、Count、Sort 等。这些特性或查询必须在服务器中实现(GraphQL API),它为您提供了几个选项:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.