|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
T-SQL - Order by
Hi,
Is it possible to give a value to the column name specified in the order by clause.. something like this.. select col1,col2 from tab1 order by col1 like 'ti%' |
|
#2
|
|||
|
|||
|
Quote:
You can do this: Code:
select col1, col2 from tab1 order by case when col1 like 'ti%' then 0 else 1 end This will force values like ti% to the top and all other values will follow in alphabetical order. But why don't you do this? Code:
select col1, col2 from tab1 where col1 like 'ti%' order by col1 |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > T-SQL - Order by |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|