21.HAVING 分组数据的过滤

类似于WHERE子句过滤文档,我们可以使用HAVING过滤分组过后的结果。

Query:

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

结果:

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

Last updated

Was this helpful?