Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
-none-

-none-

2007-10-12       - By Jay Pipes

 Back
Daevid Vincent wrote:
>  
> I'm trying to get some 'release/version numbers' to sort properly.
>
> mysql> SELECT ReleaseID, Name FROM releases ORDER BY Name DESC;        
> +-- ---- ---+-- ---- ---- ---- ---+
> | ReleaseID | Name                |
> +-- ---- ---+-- ---- ---- ---- ---+
> |        18 | Unspecified         |
> |        20 | Next Patch          |
> |        58 | LOCset              |
> |        74 | Abashiri            |
> |        54 | 4.6.0 (Folsom)      |
>              <-- 4.5.10 should be here
> |        99 | 4.5.9               |
> |        98 | 4.5.6               |
> |        93 | 4.5.5 (Purdy)       |
> |        97 | 4.5.4               |
> |        96 | 4.5.3               |
> |        94 | 4.5.2               |
> |       100 | 4.5.10              |   <-- should be ^ there
> |        91 | 4.5.1 Deferred      |
> |        78 | 4.5.1 (Leavenworth) |
> |        95 | 4.2.7.4             |
> |        92 | 4.2.7.3             |
> |        90 | 4.2.7.2             |
> |        87 | 4.2.7.1             |
> |        88 | 4.2.7.0             |  
>
> I like this order, especially with the top four,
> except for that 4.5.10 should be higher up,
> just under 4.6.0, not under 4.5.2 as it is now.
>
> So I tried the " + 0 " trick which makes things even worse
> (notice the 4.2.6.1 and 4.2.6.0 -- yipes!):
>
> mysql> SELECT ReleaseID, Name FROM releases ORDER BY Name + 0 DESC;

What about ORDER BY REPLACE(Name, '.', '') + 0 DESC?

> +-- ---- ---+-- ---- ---- ---- ---+
> | ReleaseID | Name                |
> +-- ---- ---+-- ---- ---- ---- ---+
>             ....(18,20,58,74) are moved
> :(
> |        54 | 4.6.0 (Folsom)      |
> |        78 | 4.5.1 (Leavenworth) |
> |       100 | 4.5.10              |
> |        91 | 4.5.1 Deferred      |
> |        93 | 4.5.5 (Purdy)       |
> |        94 | 4.5.2               |
> |        96 | 4.5.3               |
> |        97 | 4.5.4               |
> |        98 | 4.5.6               |
> |        99 | 4.5.9               |
> |        82 | 4.2.6.1             |  <<  ?
> |        76 | 4.2.2               |
> |        75 | 4.2.4               |
> |        72 | 4.2.1               |
> |        73 | 4.2.3               |
> |        67 | 4.2.6.0             |  <<  ?
>
>
> I'm pretty sure this is going to involve some sort of splitting the version
> from the release codeword via some string functions, and then operating on
> that part.
>
>
> D.Vin
> http://daevid.com
> ---
> eval() is my favorite templating engine.
>
>
>


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql@(protected)