Divide the results of two queries
Posted on 2008-10-29
I'm not sure what I'm doing wrong here.. I have these two queries and both return positive values in the 1k+ range on their own. The first returns a value of 1277 and the second returns a value of 6559. However, when I try to divide them to return a percentage I get 0, if I do the math on a calculator I get
0.194, which is the value I actually want. I'm sure it's something simple so thanks in advance.
SELECT Unassigned/Total FROM
(SELECT COUNT(IPAddress) Unassigned FROM Assets INNER JOIN
Contacts ON Assets.BusID = Contacts.BusID WHERE Business_Contact = 'NOT_ASSIGNED') AS TEMP1,
(SELECT COUNT(IPaddress) Total FROM Assets) AS TEMP2;