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
精彩评论