>>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement