cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Help on querying

3X_d_0_d013cf9e9182f53935228126c72595b738f00d96.png
Hi All

How can I query this? with subqueries?

I'm trying this

MATCH (o:Order)-[cont:CONTAINS]->(p:Product)-[r:PART_OF]->(c:Category)
where EXISTS {
(MATCH (:Supplier)-[:SUPPLIES]->(p))}
RETURN p.productName,cont.unitPrice;

But I get an error.

Kind Regards

1 ACCEPTED SOLUTION

@jomarca11

Maybe this query should be fine for your case?

MATCH (o:Order)-[cont:CONTAINS]->(p:Product)-[r:PART_OF]->(c:Category), 
      (supplier:Supplier)-[:SUPPLIES]->(p)
// optional WHERE part
RETURN p.productName, p.unitPrice

View solution in original post

3 REPLIES 3

Hello @jomarca11

This should be enough normally:

MATCH (o:Order)-[cont:CONTAINS]->(p:Product)-[r:PART_OF]->(c:Category)
WHERE EXISTS((:Supplier)-[:SUPPLIES]->(p))
RETURN p.productName, cont.unitPrice;

Regards,
Cobra

Hi.
It should be right if I did not need to check a property from Supplier. That's why I tried with the MATCH clause
Regards

@jomarca11

Maybe this query should be fine for your case?

MATCH (o:Order)-[cont:CONTAINS]->(p:Product)-[r:PART_OF]->(c:Category), 
      (supplier:Supplier)-[:SUPPLIES]->(p)
// optional WHERE part
RETURN p.productName, p.unitPrice