Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query help- return some records at the end?

Author  Topic 

sbt1
Yak Posting Veteran

89 Posts

Posted - 2004-12-29 : 06:50:24
I have a simple query that returns a list of items, which are then used by the application to fill a drop-down (combo) box.

What I'd like to do is have the query return the results in ascending alphabetical order, except have ones with a certain prefix ("GTX_" show up at the end of the list (and those in asc. alphabetical order too).

In other words:
Alpha
Beta
...
Zulu
GTX_apple
GTX_cherry
GTX_Pineapple

make sense?

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-29 : 07:08:03
order by case when left(mycol,4) = 'GTX_' then 1 else 0 end , mycol


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -