Help on querying

image
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

Hello @jomarca11 :slight_smile:

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

1 Like