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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL help - trying to calculate a percentage.

Status
Not open for further replies.

BobLoblaws

Programmer
Nov 20, 2001
149
CA
I am trying to calculate a percentage. The problem I am having is that I am dividing integers resulting in a 0 instead of a decimal or percentage. Here is a parsed variation of my SQL. The Fill Rate always results in a 0...

SELECT mast_chain AS 'Master Chain',
long_desc AS 'Description',
COUNT( DISTINCT order_date) AS 'Orders Placed',
COUNT( DISTINCT return_date) AS 'Short Shipped',
COUNT( DISTINCT invc_date) AS 'Complete',
COUNT( DISTINCT invc_date) / COUNT( DISTINCT order_date) AS 'Fill Rate'
FROM tablename
WHERE blah, blah, blah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top