nebula graph 2.01版本 groupby 后如何过滤数据

1、查询语句
GO xxx | GROUP BY $-.a YIELD $-.a as a, sum($-.b) as b | ORDER BY b

2、现在想在groupby后将聚合后的数据过滤
GO xxx | GROUP BY $-.a YIELD $-.a as a, sum($-.b) as b | YIELD $-.a,$-.b WHERE $-.b > 100 | ORDER BY b
报错:
[ERROR (-12)]: SemanticError: $-.b', not exist prop b’

目前使用的版本是2.0.1。求教各位该怎么解决

GO 的用法好像不对,是 GO FROM xxx

额。。。我只是略过了前边的go语句,group by之前的是没问题的,可以跑通的

蹲贴

您好,2.5之后 order_by 需要带上引用符,看我这个query是可以的。

文档:ORDER BY - Nebula Graph Database 手册

(root@nebula) [basketballplayer]> GO FROM "player100" OVER follow BIDIRECT YIELD $$.player.name as Name, $$.player.age as Age | \
  GROUP BY $-.Name YIELD $-.Name as Player, sum($-.Age) AS age_sum | \
  YIELD $-.Player as Player, $-.age_sum as age_sum WHERE $-.age_sum > 40 | \
  ORDER BY $-.age_sum
+--------------------+---------+
| Player             | age_sum |
+--------------------+---------+
| "Shaquille O'Neal" | 47      |
+--------------------+---------+
| "Tony Parker"      | 72      |
+--------------------+---------+
| "Manu Ginobili"    | 82      |
+--------------------+---------+

找到问题了,不是过滤有问题,是我最后的order by有问题。。。感谢帮助 :laughing:

1 个赞

浙ICP备20010487号