sql - Convert result within statement -


Assume that I have the following simple query

  select the top 1 name for months < / Code> 

which gives name = "march" is it possible to change this result? Instead of "march" let me name = "3" what SQL is able to do such things? I am using an MSSQL database.

[Update] Corrected the query. When writing this simple example, I mixed it with MySQL [/ Update]

You want to map a certain set of input values ​​against a certain set of output values, when is the case your friend:

  select name name then 'Jan' was then 1 when 'February' then 2 when 'march' then 3 / * ... * / END months as number of  

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -