Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's wrong with this SQL
Message
From
25/09/2007 13:44:49
 
 
To
25/09/2007 13:30:30
Suhas Hegde
Dental Surgeon
Sirsi, India
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01256723
Message ID:
01256733
Views:
13
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
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform