Scott Haneda wrote:
> 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.

Bit of a late response ... try: ORDER BY   lpad( l.age, 7, '0'  ), l.date
It might slow down response as index on I.age is no longer used by sort.

On the long term consider storing the value with prepended zeros and trim
them during select:
SELECT l.team, l.link, lc.category, trim(leading '0' from l.age ), l.date



HansH


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

Reply via email to