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.

Variable Not defined

This is my query

MATCH (n:SampleLabel)-[:R1]->(n2:Genus) WITH 
            { 
                name:n.name, 
                genus_specie: n2.genus_specie
            } AS productDetails RETURN productDetails ORDER BY n.name
            SKIP 0 LIMIT 50

When I execute it says

Neo.ClientError.Statement.SyntaxError: Variable `n` not defined (line 5, column 74 (offset: 220)) " } AS essentialOilDetails RETURN essentialOilDetails ORDER BY n.name" ^
1 ACCEPTED SOLUTION

I solved it. It's working now I just had to replace n.name with productDetails.name, thanks for the reply.

View solution in original post

2 REPLIES 2

niclasko
Node Clone

Hi,

The variable n must be listed in the WITH clause in order for it to be available to the ORDER BY clause.

I solved it. It's working now I just had to replace n.name with productDetails.name, thanks for the reply.