sql - Natural or Human Sort order -


i have been working on over months. cannot natural (true alpha-numeric) results. shocked cannot them have been able in rpg since 1992 ebcdic.

i looking solution in sql, vbs or simple excel or access. here data have:

299-8,  3410l-87,  3410l-88,  420-a20,  420-a21,  420a-40,  4357-3,  an3h10a,  k117gm-8,  k129-1,  k129-15,  k271b-200l,  k271b-38l,  k271d-200el,  kd1051,  kd1062,  kd1092,  kd1108,  kd1108,  m8000-3,  ms24665-1,  sk271b-200l,  saya4008 

the order looking true alpha-numeric order below:

an3h10a,  kd1051,  kd1062,  kd1092,  kd1108,  kd1108,  k117gm-8,  k129-1,  k129-15,  ms24665-1, m8000-3,  saya4008,  sk271b-200l 

the inventory 7800 records have had problems processing power well.

any appreciated.

jeff

in native excel, can add multiple sorting columns return ascii code each character, if character number, add large number code (e.g 1000).

then sort on each of helper columns, including first column in table, not in sort.

the formula:

=iferror(code(mid($a1,columns($a:a),1))+and(code(mid($a1,columns($a:a),1))>=48,code(mid($a1,columns($a:a),1))<=57)*1000,"") 

the sort dialog:

enter image description here

the results:

enter image description here

you can implement similar algorithm using vba, , sql also. dunno vbs or access.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -