I need to do a calculation of two fields, field1 / field2 then need to get the percentage of the result from the divide by 100%. Below is what I have written so far, which it works, but doesn't give the right percentage.
SELECT a.items, a.orders, c.items_credited, SUM(c.items_credited) / (a.items)-100
FROM credits c, invoice a
WHERE a.county_id = c.county_id
GROUP BY c.items_credited
Items will be a number like 2356, items credited by like 5, I'm dividing 5 from 2356 then -100, which is not giving the right results. Is there a better to do this to get the percentage.
Thanks
Heydyrtt
SELECT a.items, a.orders, c.items_credited, SUM(c.items_credited) / (a.items)-100
FROM credits c, invoice a
WHERE a.county_id = c.county_id
GROUP BY c.items_credited
Items will be a number like 2356, items credited by like 5, I'm dividing 5 from 2356 then -100, which is not giving the right results. Is there a better to do this to get the percentage.
Thanks
Heydyrtt