Cypher - UNWIND UNION

UNWIND   將一個列表展開爲一個行的序列spa

// 指定一個集合,行展開it

 unwind [1,2,3] as x
 return x
io

//集合去重nio

with [1,1,2,2] as coll
unwind coll as x
with distinct x
return collect(x) as set
nw

union 用於將多個查詢結果組合起來
  --查詢到的列名和列數必須徹底一致
  -- all union 會包含全部結果。而 union 會去重查詢

match (u:User{id:1})
return u.name as name
union all
match (o:User{id:8})
return o.name as name
集合

相關文章
相關標籤/搜索