Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's wrong with this SQL
Message
De
25/09/2007 13:30:30
Suhas Hegde
Dental Surgeon
Sirsi, Inde
 
 
À
25/09/2007 13:26:50
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:
01256726
Vues:
8
>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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform