Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
SQL 有“Having”子句,例如:
SELECT LastName, COUNT(*) FROM Employees GROUP BY LastName HAVING COUNT(*) > 10;
在 Cypher 中,我们可以做 count()
START n=node(2) MATCH (n)-[r]->() RETURN type(r), count(*)
但是 Cypher 是否具有与“Having”类似的功能,或者是否有任何解决方法?
当然,拥有只是查询链接的众多用途之一,WITH它类似于RETURN但确定哪些元素将在下一个查询部分中可用。WITH还支持排序和分页。
WITH
RETURN
START n=node(2) MATCH (n)-[r]->() WITH type(r) as t, count(*) as c WHERE c > 10 RETURN t,c