简体   繁体   中英

Cypher: How to merge two nodes' keys in a third node

in cypher i want to create a node that has attributes of two existing nodes. I know that to "copy" a node the query is: MATCH (old:Type) CREATE (new:Type) SET new=old but this allow me to have the keys from just one node. I need a way to join the keys of two nodes and copy that node

match (a:Ubuntu1604), (h:Host) CREATE (b:Ubuntu1604) SET b=a,b=h return b 

will obviously create b equals to h. I need and "append" function

I figured out myself. Solution is simply

match (a:Ubuntu1604), (h:Host) CREATE (b:Ubuntu1604) SET b=a, b+=h return b

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM