在这个查询中,我有一个:
START root = node(*)
MATCH root-[:HAS_DEPARTMENTS]->()<-[:IS_DEPARTMENT]-department-[relationship1:HAS_CATEGORY_SUGGESTION]->categorySuggestion-[relationship2:IS_CATEGORY_SUGGESTION]->()<-[:HAS_CATEGORY_SUGGESTIONS]-root
WHERE root.name = "Store" and department.name = "foo" and categorySuggestion.name = "bar"
DELETE relationship1, relationship2
WITH root, department, categorySuggestion
MATCH root-[:HAS_CATEGORIES]->categories
CREATE department-[:HAS_CATEGORY]->categorySuggestion
CREATE categories<-[:IS_CATEGORY]-categorySuggestion
我有一个 WITH 子句分隔两个部分。
如果我将 DELETE 移到 WITH 下方,我会收到错误消息。
我只是想知道,我怎么知道应该在哪里使用 WITH。
有一些黄金法则吗?