Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hii

i have a table in which a column name is 'wmode' and another coulumns are 'wvaluemin' and 'wvaluemax'.
wmode has two types of value 'inbetween' and 'greater'.
now what i want to do is a select query , if wmode values is inbetween then output should be 'Between wvaluemin & wvaluemax. else if wmode is greater then output should be 'Greater then wvaluemax'
how can i accomplish this by an if else statement or anyhow .
Posted
Comments
Shanalal Kasim 2-Nov-12 5:22am    
please provide a sample table record

1 solution

Try:

SQL
Select case wmode
  when 'inbetween' then 'Between ' +convert(varchar,wvaluemin )+ ' &' +convert(varchar,wvaluemax) 
  else   'Greater then' + convert(varchar,wvaluemax)
from table
 
Share this answer
 
Comments
choudhary.sumit 2-Nov-12 5:55am    
thanks.. very helpful
5 star
MT_ 2-Nov-12 6:21am    
If it helped you to solve your problem , mark it as answer
damodara naidu betha 5-Nov-12 5:49am    
5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900