Cypher query order by and null value

37 views
Skip to first unread message

Newbie

unread,
Feb 22, 2012, 8:30:39 PM2/22/12
to Neo4j
I am using cypher query and order the result via order by on a numeric
property. The property value can be null. When I use descending order,
the null appear first, which was expected.

Is there a way to treat null as 0 so that null value appears first
when sorted in ascending order and appear last when in descending
order?

Thanks,

Andres Taylor

unread,
Mar 6, 2012, 9:35:36 AM3/6/12
to ne...@googlegroups.com
Sorry for the long delay...

Have you tried using coalesce for this?

Something like:

RETURN a.prop?
ORDER BY COALESCE(a.prop?, 0)

HTH,

Andrés
Reply all
Reply to author
Forward
0 new messages