The leading 0 is causing the problem.

Convert to a numeric type in the order by clause or alias the a casted
column and order by that:

SELECT yourColumns, CAST(AccountID AS INT) orderByAccountID
FROM yourTable
ORDER BY orderByAccountID

Adrian
Building a database of ColdFusion errors at http://cferror.org/

-----Original Message-----
From: [EMAIL PROTECTED]
Sent: 21 October 2008 21:28
To: cf-newbie
Subject: Numerical order of query results

Hello,

I have a simple problem, but don’t know how to remedy it.  I have a query
that returns accountIDs among other things.  The query has an Order By
AccountID.  Everything goes fine if the Account Id is only 7 numbers like
0112345, but if the Account ID is 8 numbers as in 01103456, the latter
number (the 8digit  number), which is larger, will appear before any of the
seven digit numbers. I need it to appear in actual numerical order.  How
can I handle the results of the query to do that, or how can I change the
query to assure numerical order?

Thanks,

Lewis


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4063
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to