1
在此查詢我有一個:何處使用WITH?
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,我會得到一個錯誤。
我只是想知道,我怎麼知道我應該在哪裏使用。
是否有一些黃金法則?