[thelist] SQL ORDER BY

Tab Alleman talleman at Lumpsum.com
Thu Apr 20 14:01:07 CDT 2006

Well if your database is MS SQL Server, you can do this neat little trick:

	WHEN 'open' THEN 0
	WHEN 'close' THEN 1
	WHEN 'suspended' THEN 2

> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Rickards, Julian
> (NDM)
> Sent: Thursday, April 20, 2006 2:45 PM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] SQL ORDER BY
> To the best of my knowledge, the only options for Order by is 
> Ascending or Descending. The only way I can think of to do 
> what you want is to have three queries and use the WHERE 
> Class=Open (Close and Suspended) as the separation of the 
> three classes but that will result in all of Class=Open 
> followed by all Class=Close followed by all Class=Suspended. 
> If this meets your needs, it might be something to consider.
> The other possibility is to possibly modify the data so that 
> Open is changed to 1Open, Close to 2Close and Suspended to 
> 3Suspended and this will solve the order by issue immediately.
> -----Original Message-----
> In asp when you do a Select statement - is there anyway to 
> have it ORDER BY specific words in a column?  
> In the class column it says Open or Close or Suspended.  With 
> a Select statement can I tell it to ORDER BY Class  - Open 
> then Close then Suspended?
> -- 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 

More information about the thelist mailing list