Help on querying

jomarca11
Node

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

Cobra
Ninja
Ninja

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

jomarca11
Node

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