Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to do an easy sql statement
Message
 
 
To
04/03/2002 16:26:40
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00628074
Message ID:
00628124
Views:
15
>What's the easiest way in a select statement to return 'Horrizontal' if a field value is 0 and 'Vertical' if a field value is 1?
>
>ie; select field1,field2,iif(field3=0,'Horrizontal','Vertical') as feild3
>
>Thanks,
>Darren.

You can use CASE function.
 select field1, field2, 
  CASE WHEN field3=0 THEN 'Horrizontal' ELSE 'Vertical' END as feild3
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform