Reputation: 373
In the Northwind Graph worked example provided by neo4j I can find the supplier with the most products with the query:
MATCH (s:Supplier)-[r]->(p:Product)
RETURN s, COUNT(r) as c
order by c DESC
limit 1
What I'm trying to do is return the supplier with the most products along with their products.
Upvotes: 1
Views: 87
Reputation: 9369
You can simply add the Product
to the RETURN
statement:
MATCH (s:Supplier)-[r]->(p:Product)
RETURN s, COUNT(r) as c, collect(p)
order by c DESC
limit 1
Upvotes: 2