OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Order by a number not leading in zero

From: Matt W (mysql_listsrealplain.com)
Date: Thu Nov 13 2003 - 18:05:43 CST


Hi Scott,

This kind of ordering thing has come up before and there's never a great
answer I don't think.

You could try this ORDER BY

ORDER BY l.age + 0.0, l.age, l.date

But I think that might cause sorting problems if age has leading 0s.
Maybe not...

Matt

----- Original Message -----
From: "Scott Haneda"
Sent: Thursday, November 13, 2003 5:34 PM
Subject: Order by a number not leading in zero

> I have the following...
>
> tSql = "SELECT l.team, l.link, lc.category, l.age, l.date
> FROM league AS l
> INNER JOIN league_category AS lc
> ON l.category = lc.id
> WHERE lc.id = " & prepSQL(tConn, id) & " AND l.status = '1'
> ORDER BY l.age, l.date";
>
> L.age has data in it as varchar() where there are some without a
leading
> zero.
>
> Rsults end up like
> 10U
> 11U
> 12U
> 5U
> 6U
> 7U
>
> I would like to order those as
> 5U
> 6U
> 7U
> 10U
> 11U
> 12U
>
> Thanks for the help.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql