How to get the order of a query result

I have a simple question I wasn't able to answer:

Imagine I have a query.

   WITH x 
   ORDER BY x.prop

return counter(x), X

where the counter is a number from 0/1 up to the number of the results.

In other words, I want to added a column which represent a counter, so I can later rearrange the results, but maintaining the original reference and then being able to directly access the array of the result.

Is a crazy idea or someone know how to achieve that?


Hi @paolodipietro58 !

You may find this link useful! :wink:


Well, seem to be too difficult to implement due to the parallelism.
I solved implementing it in javascript.
But is interesting to discover not to be alone into the universe ;-)