
June 12th, 2008, 08:50 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
natural sort via substrings
Hi, I am attempting to do a "natural sort" from within mysql, if possible.
So, for example, jane2 would come before jane10, and normal strings would
still sort as expected. I found some solutions, like using length for the
numerical part, but that only works if the strings are the same length.
Ideally, I would like to use substring_index, but stick a regexp in as the
delimiter. So far, it seems you cannot do this. Does anyone know how to
put a regexp as the delimiter in substring_index? For example, I want to do
something like this:
order by substring_index(name, 'regexp [0-9]+', 1);
Is this possible?
-Emily
|