Reputation: 189
MATCH (a)-[:PRODUCED
]->(b) RETURN a
MATCH (a)-[:PRODUCED
]->(b) RETURN a.name
How will I do that or what will be the exact cypher query?
Upvotes: 2
Views: 392
Reputation: 10856
You have a couple of options, I think:
MATCH (a)-[:PRODUCED]->(b) RETURN DISTINCT a.name
or
MATCH (a)-[:PRODUCED]->(b) WITH a RETURN a.name
The former returns distinct names, which isn't good if you have multiple nodes with the same name and you want that result returned. The later should pass on the set of distinct nodes and then return their names. If that doesn't work, you could try WITH DISTINCT a
Upvotes: 2