简体   繁体   中英

Neo4j cypher Query - How to get specific labels data?

I want to get only customer and supplier name and ID using cypher query.

"Match (n: customer:supplier) where has (n.ID) return n.ID,n.nme";

How to combine 2 labels to get the data?

Above query is getting syntax error. Please advise.

This for OR label matching:

MATCH (n) 
WHERE (n:customer OR n:supplier) AND exists(n.ID)
RETURN n.ID, n.nme

This for AND label matching:

MATCH (n:customer:supplier) 
WHERE exists(n.ID)
RETURN n.ID, n.nme

The has() function has long since been deprecated and removed. Use exists() instead.

Also I'm not sure what you mean by combine 2 labels to get the data. The query as it is now will only match to nodes with both the :customer and :supplier label. Is that what you want?

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