Cool. That did the trick. Thanks to all! 

-----Original Message-----
From: Gaulin, Mark [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 25, 2008 2:08 PM
To: CF-Talk
Subject: RE: SQL Question -- Order by a column's value?

Yes, you can do this with a CASE statement.  The syntax may depend on you
db, but on SQL Server


ORDER BY 
        CASE Colleges 
                WHEN 'Harvard' THEN 1
                WHEN 'Princeton' THEN 2
                WHEN 'Dartmouth' THEN 3
                ELSE 100
        END

This would put those three colleges in that order, and all others would go
after them.  To be smart you should add another ORDER BY field to sort all
of the ones that hit the default case in some way (so, sort by the CASE
statement, then by the Colleges field).

Thanks
        Mark

-----Original Message-----
From: Che Vilnonis [mailto:[EMAIL PROTECTED]
Sent: Friday, January 25, 2008 1:41 PM
To: CF-Talk
Subject: OT: SQL Question -- Order by a column's value?

Suppose I have a small set of data with a column named "Colleges". Is there
a way to write an ORDER BY statement to say something like...
ORDER BY Colleges 'Harvard', Colleges 'Princeton', Colleges 'Dartmouth'???

Just wondering... Che






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

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

Reply via email to