本文介绍了Neo4j Cypher 查询可以做与“拥有"类似的事情吗?在 SQL 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SQL 有Having"子句,例如:
SQL has "Having" clause, for example:
SELECT LastName, COUNT(*)
FROM Employees
GROUP BY LastName
HAVING COUNT(*) > 10;
在 Cypher 中,我们可以执行 count()
In Cypher, we can do count()
START n=node(2)
MATCH (n)-[r]->()
RETURN type(r), count(*)
但是 Cypher 是否具有类似于拥有"的功能,或者有什么解决方法?
But does Cypher have similar function as "Having", or is there any workaround?
推荐答案
当然,使用 WITH
查询链接只是其中一种,它类似于 RETURN
> 但确定哪些元素将在下一个查询部分可用.WITH
还支持排序和分页.
Sure, having is just one of the many uses of query chaining with WITH
which is similar to RETURN
but determines which elements will be available in the next query part. WITH
also supports ordering and paging.
START n=node(2)
MATCH (n)-[r]->()
WITH type(r) as t, count(*) as c
WHERE c > 10
RETURN t,c
这篇关于Neo4j Cypher 查询可以做与“拥有"类似的事情吗?在 SQL 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!