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.
| Author |
Topic |
|
Zath
Constraint Violating Yak Guru
298 Posts |
Posted - 2008-08-26 : 14:00:53
|
| I want this list to be in order a certain way.But I want just one in the list to be at the end.Need a little input here on this one....select Name from Eventwhere Code <> 'P'--order by NameUNIONselect Name from Eventwhere Code = 'P'It doesn't like the order byI just want the ordered list with out one to put at the end.Thanks,Zath |
|
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-08-26 : 14:07:01
|
| [code]select [Name] from Eventorder by Case Code WHEN 'P' THEN 1 Else 0 END asc, [name][/code]"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
|
Zath
Constraint Violating Yak Guru
298 Posts |
Posted - 2008-08-26 : 14:13:43
|
| I simplified the sql for my post.I applied your suggestion and it's not working right...select EventGroupCode, EventGroupName, IsNull(WebDescription, '') WebDescription, SmartFormIDfrom EventGrouporder by Case EventGroupName WHEN 'ICP' THEN 1 Else 0 END asc, EventGroupNameI even tried select EventGroupCode, EventGroupName, IsNull(WebDescription, '') WebDescription, SmartFormIDfrom EventGrouporder by Case EventGroupName WHEN 'ICP' THEN 1 Else 0 END asc, EventGroupName, EventGroupName, IsNull(WebDescription, '') WebDescription, SmartFormIDBut it didn't like WebDescriptionSuggestions?Thanks again,Zath |
 |
|
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-08-26 : 14:24:01
|
| [code]select EventGroupCode, EventGroupName, IsNull(WebDescription, '') as WebDescription, SmartFormIDfrom EventGrouporder by Case EventGroupCode WHEN 'ICP' THEN 1 Else 0 END asc, EventGroupName[/code]"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
|
Zath
Constraint Violating Yak Guru
298 Posts |
Posted - 2008-08-26 : 14:30:25
|
| Thanks. Had a field wrong.Zath |
 |
|
|
|
|
|
|
|