# Divide the results of two queries

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;
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
use cast...
``````SELECT CAST(Unassigned AS DECIMAL)/CAST(Total AS DECIMAL) 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;
``````
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
heh.. I knew it was simple.. thanks for the help Binuth.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.