20.GROUP BY 分组

在这个例子中我们基于relation字段形成不同的组。

Query:

SELECT relation, COUNT(*) AS count
    FROM tutorial
        GROUP BY relation

结果:

{
  "results": [
    {
      "count": 2,
      "relation": "friend"
    },
    {
      "count": 1,
      "relation": "coworker"
    },
    {
      "count": 1,
      "relation": "parent"
    },
    {
      "count": 2,
      "relation": "cousin"
    }
  ]
}

Last updated

Was this helpful?