> -----Original Message-----
> From: Emily Heureux [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 12, 2008 8:25 PM
> To: mysql@lists.mysql.com
> Subject: 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'd try adding a column (e.g. "sort_as") to your table, and then populate that 
with strings suitable for sorting (e.g. "jane2" would become "jane0002", 
"jane10" => "jane0010", and so on).

One nice thing about this is that you can use an external language like Java, 
Perl, or Python to calculate your sort string.  SQL is a painful choice for 
that task in my opinion.

HTH, HAND.
J

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to