Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL-Server Syntax
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00168271
Message ID:
00168289
Vues:
21
>>This may sound simple but it isn't for me... Am i missing something or is it just not allowed... I would like to issue a command similar to the following from VFP into SQL-Server
>>
>>select iif( DollarSales < 5000, "low", "hi" ) as saleslvl
>> from Sales
>>
>>In SQL, I know it doesn't support the IIF() but what alternatives do I have. I know it doesn't support logical fields as TRUE or FALSE in expressions, they must all be based on a numerical differential...
>>
>>Any input would be greatly appreciated...
>>
>>TIA
>
>You should use CASE statement within SELECT:
>Select 'SalesLvl'=CASE When DollarSale<5000 Then 'low' Else 'hi' END From ....

Great!!!
Thank you... I didn't know you could put the equation at each WHEN level... I thought it was more like C where you did a primary equation, then handled each possible result after...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform