Lewis, Have you tried
ORDER BY convert(numeric(8),getJobs.accountID) Dave -----Original Message----- From: Lewis Billingsley [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2008 4:29 PM To: cf-newbie Subject: Re: Numerical order of query results Thanks. But, I got an error saying: Encountered "INT. Incorrect Select List, Unsupported cast type: AS The server is SQL Server, is that a problem? Here is the query as I'm using it: SELECT CAST(getJobs.accountID AS INT) accountID, getJobs.accountName, getJobs.SRep, COUNT(getJobs.JobN) as jTotal, SUM(getJobs.ESC1) as esTotal, SUM(getJobs.revTotal) as ttTotal FROM getJobs GROUP By accountID, getJobs.accountName, getJobs.SRep HAVING SUM(getJobs.revTotal) #oper# #param# ORDER By accountID </CFIF> >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/ > >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:4065 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
