What with clause do? Neo4j

▼魔方 西西 提交于 2019-12-05 08:09:31

WITH allows you to pass on data from one part of the query to the next. Whatever you list in WITH will be available in the next query part.

You can use aggregation, SKIP, LIMIT, ORDER BY with WITH much like in RETURN. The only difference is that your expressions have to get an alias with AS alias to be able to access them in later query parts.

That means you can chain query parts where one computes some data and the next query part can use that computed data. In your case it is what GROUP BY and HAVING would be in SQL but WITH is much more powerful than that.

here is another example

match (n:Team) -[r1:PLAYS]->(a:Stadium)
with distinct a 
order by a.name limit 10
match (a)-[:IN_CITY]->(c:City)
return c.name
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!