Thanks Jim!  That works great for me!

I will have to look up CASE, I am not familiar with that function.

Thanks again!

-----Original Message-----
From: Jim Wright [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 25, 2007 9:26 AM
To: CF-Talk
Subject: Re: SQL order by

Chad Gray wrote:
> 
> I cannot switch it to an integer field because there will be some text also.
> 
> Any way to accomplish this?
> 

maybe something like...
SELECT thefield FROM foo
ORDER BY CASE WHEN IsNumeric(thefield)=1 THEN CAST(thefield AS INT) ELSE 
0 END,thefield

That should put the text fields at the beginning, sorted alphabetically, 
and the numeric fields at the end, sorted numerically.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267607
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to