Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's wrong with this SQL
Message
De
25/09/2007 13:44:49
 
 
À
25/09/2007 13:30:30
Suhas Hegde
Dental Surgeon
Sirsi, Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01256723
Message ID:
01256733
Vues:
12
Thanks!

>>Hi:
>>
>>The following SQL produces the following output. Obviously there's something wrong with the IIF, but how do I guard against division by zero?
>>
>>Thanks,
>>
>>Yossi
>>
>>SELECT SUM(FeedWeight) FeedWeight, ;
>>	SUM(FeedCost) FeedCost, ;
>>	SUM(Feedcost)/iif(SUM(FeedWeight)=0,0.001,SUM(FeedWeight)) FeedCostPerlbFeed ;
>>	FROM prereportcursor ;
>>	INNER JOIN curCoop ;
>>	ON curCoop.CODE = feedmill ;
>>	GROUP BY curCoop.CODE ;
>>	INTO CURSOR ReportCursor
>>
>>
>>FEEDWEIGHT            FEEDCOST    FEEDCOSTPERLBFEED
>>         0.00        0.00000000                 0
>>   3270490.00      245.77180000                 0
>>   4286240.00   398193.47120000                 0
>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform