Skip to content

Instantly share code, notes, and snippets.

@mhluongo
Last active December 11, 2015 18:58
Show Gist options
  • Save mhluongo/4645421 to your computer and use it in GitHub Desktop.
Save mhluongo/4645421 to your computer and use it in GitHub Desktop.
A quick bit of Cypher demonstrating how you can change the default null-ordering in ORDER BY. Note that the trick is in the null predicate and STR cast.
START n=node({startId})
MATCH (n)-[?:DID]->(thing)
WITH thing, (thing.year? = null) AS year_is_null
WITH thing, STR(year_is_null) as null_year
ORDER BY null_year, thing.year? DESC
RETURN thing, thing.year? as year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment