Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Divide by zero error encountered.??? how?? [urgent]

Divide by zero error encountered.??? how?? [urgent]

Scheduled Pinned Locked Moved Database
questiondatabasehelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    campbells
    wrote on last edited by
    #1

    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'

    C 1 Reply Last reply
    0
    • C campbells

      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'

      C Offline
      C Offline
      ChandraRam
      wrote on last edited by
      #2

      Try adding " and totalsales<>0" to your where clause Chandra

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups