Divide by zero error encountered.??? how?? [urgent]
-
I have create a SQL there r some calculation involve, but i got this error:Divide by zero error encountered. But there is some which work when i select some others DATE but with some other date which no result came out becasue "Divide by zero error encountered." how can i make the SQL will just continue show those value out even is 0.01... something??
select bizdate,concesscode,con. [description],totaltrans,totalqty,totalwgt,totalsales,taxper, (totalsales*taxper/100) as TaxAmt,baseamt,level3per as APPLY , (level3per*(totalsales-Taxper/100))as LeaseAmt,(totalsales-baseamt- (totalsales*taxper/100)-(level3per*(totalsales-taxper/100)))as AmountDue ,discountamt, returnamt,(totalsales-totalcost)*100/totalsales as GP from tot_item ti, concess con where con.code=ti.concesscode and ti.bizdate='2006-04-11' and concesscode>='A' and concesscode<='D'
-
I have create a SQL there r some calculation involve, but i got this error:Divide by zero error encountered. But there is some which work when i select some others DATE but with some other date which no result came out becasue "Divide by zero error encountered." how can i make the SQL will just continue show those value out even is 0.01... something??
select bizdate,concesscode,con. [description],totaltrans,totalqty,totalwgt,totalsales,taxper, (totalsales*taxper/100) as TaxAmt,baseamt,level3per as APPLY , (level3per*(totalsales-Taxper/100))as LeaseAmt,(totalsales-baseamt- (totalsales*taxper/100)-(level3per*(totalsales-taxper/100)))as AmountDue ,discountamt, returnamt,(totalsales-totalcost)*100/totalsales as GP from tot_item ti, concess con where con.code=ti.concesscode and ti.bizdate='2006-04-11' and concesscode>='A' and concesscode<='D'
Try adding " and totalsales<>0" to your where clause Chandra