Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to do an easy sql statement
Message
 
 
À
04/03/2002 16:26:40
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00628074
Message ID:
00628124
Vues:
14
>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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform