Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Statement in SELECT
Message
De
24/12/2007 17:38:03
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01276157
Message ID:
01277394
Vues:
23
Of course. Thanks.

>In addition, your check may not prevent division by 0. You should check feedweight not feedcost. Add following record to see it
>
>INSERT INTO PreXtab (feedcost, feedweight) VALUES (1,0)
>
>>
>>I have the following code with an iif statement to avoid division by zero. BUT I'm getting zero in all the records even though there should only be a zero in the first.
>>
>>What is the correct syntax?
>>
>>Thanks,
>>
>>Yossi
>>
>>
>>CREATE CURSOR PreXtab (feedcost N(5), feedweight N(6))
>>iNSERT INTO PreXtab (feedcost, feedweight) VALUES (0,0)
>>iNSERT INTO PreXtab (feedcost, feedweight) VALUES (45000, 200000)
>>iNSERT INTO PreXtab (feedcost, feedweight) VALUES (46000, 190000)
>>iNSERT INTO PreXtab (feedcost, feedweight) VALUES (47000, 180000)
>>
>>SELECT IIF(feedcost = 0,0,feedcost / feedweight) feedcostperlb ;
>>FROM prextab ;
>>INTO CURSOR test
>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform