BobLoblaws
Programmer
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
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