开发者

Get Names from Values in a select statement + Sql server 2005

Here is my query

Select Gender from Table

The result pane shows

1

开发者_StackOverflow社区 1

1

2

2

But i want the results to be

Male

Male

Male

Female

Female

The names Male and Female wont be present in my database.... I want to just hardcode the names based on values from the select statement....


try

Select case WHEN Gender=1 THEN 'Male' ELSE 'Female' end Gender  from Table
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜