Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with Division ZERO problem

Status
Not open for further replies.

lloydanderson

IS-IT--Management
Sep 26, 2001
21
0
0
US
Hello,

really new at databases - trying to show the value of having a database at work- I have a divide by zero error -
I have about twenty calculations of this type;

[WG Occ Rooms], [WG Room Rev]/[WG Occ Rooms] AS [WG AVG Rate]
In access the results are #ref# but SQl returns divide by zero erro

The default on these colums is zero - how can make this calculation work?

Your help is appreciated.
 
Never mind figured it out:

Case when [CG Occ Rooms] = 0 then 0 else [CG Room Rev]/[CG Occ Rooms] end AS [CG AVG Rate],

As I said, very new to databases...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top