Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-30-2020 08:37 AM
Hello ,
When I am trying to sort by alphanumeric, it is not happening in proper manner.Please find below.Is it another way to sort alphanumeric?
match(n:t1) return n.qi,n.qd order by n.qi;
+----------------+
| n.qi | n.qd |
+----------------+
| "q1" | "q1" |
| "q10" | "q10" |
| "q11" | "q" |
| "q11b" | "q1" |
| "q12" | "q1" |
| "q13" | "q1" |
| "q1a" | "q1" |
| "q1b" | "q1" |
| "q2" | "q2" |
| "q3" | "q3" |
+----------------+
Out put should be like this:
+----------------+
| n.qi | n.qd |
+----------------+
| "q1" | "q1" |
| "q1a" | "q1" |
| "q1b" | "q1" |
| "q2" | "q2" |
| "q3" | "q3" |
| "q10" | "q10" |
| "q11" | "q" |
| "q11b" | "q1" |
| "q12" | "q1" |
| "q13" | "q1" |
+----------------+
08-07-2020 08:14 PM
I do understand this is not what you wanted, but technically speaking in terms of alpha-numeric sorting it is sorting correctly.
q10 will below q2, because each character is compared in order that they occur. q1<q2
if the data was q02 and q10 it would have sorted q02<q10
For example, the data looked more like below I think it would sort the way you were hoping.
+----------------+
| n.qi | n.qd |
+----------------+
| "q01" | "q01" |
| "q01a" | "q01" |
| "q01b" | "q01" |
| "q02" | "q02" |
| "q03" | "q03" |
| "q10" | "q10" |
| "q11" | "q" |
| "q11b" | "q01" |
| "q12" | "q01" |
| "q13" | "q01" |
+----------------+
All the sessions of the conference are now available online