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 |
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-03-12 : 03:03:27
|
| Name Age ClassCodeMay 10 A23Jane 12 A40John 12 A40Kim 11 A40I would like to select all data.But only give the output which class code = A40.If class code is not A40, just leave it blank.Can I do that?The result should be like this:Name Age ClassCodeMay 10 Jane 12 A40John 12 A40Kim 11 A40 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-03-12 : 04:10:49
|
[code]select Name, Age, ClassCode = case when ClassCode = 'A40' then ClassCode else '' end[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-12 : 10:01:09
|
| looks like a presentation requirement to me------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|