Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to make query results positive or negative ?
Message
 
À
13/01/2000 04:58:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00317439
Message ID:
00317448
Vues:
13
John,

I'll assume that your transaction table has the fields cTransactionType ("BUY" or "SELL") and yTransactionAmount.

Try
SELECT TYPE, ;
   TOTAL * iif(TYPE = "BUY", 1, -1) as TOTAL ;
 FROM Transaction ;
 yada, yada, yada ...
Cheers,

Andrew

>I do have a query like: SELECT TYPE, TOTAL from Transaction
>which results something like:
>TYPE TOTAL
>BUY 2000
>SELL 1000
>SELL 500
>
>However I would like to have the result like this
>BUY + 2000
>SELL - 1000
>SELL - 500
>
>So depending on the TYPE there will be a + / - before the TOTAL.
>How can I make that happen ?
>
>Thanks
>
>John
>
>PS: feel free to send suggestions to my private emailaddress


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform