Jack Daniel
Jack Daniel

Reputation: 2611

Neo4j - ORDER BY syntax error

This cipher query is throwing the syntax error when I am sorting the result on relationship property using ORDER BY clause.

My query:

$MATCH(a{word:"review"})-[co:coocr]->(b) RETURN co LIMIT 20 ORDER BY co.val DESC

Syntax Error report:

Invalid input 'R': expected 'p/P' (line 4, column 2 (offset: 60))
"ORDER BY co.val DESC"
  ^

where the relationship co exists a property like "val:0.66" where value is a double valued number.

Please some one suggest where I am missing out.

Upvotes: 1

Views: 102

Answers (1)

Bossie
Bossie

Reputation: 3612

Just reverse the order of the LIMIT and ORDER BY clauses:

MATCH (a{word:"review"})-[co:coocr]->(b)RETURN co ORDER BY co.val DESC LIMIT 20;

Upvotes: 2

Related Questions