Here’s the query:
select
(
SELECT COUNT(*)
FROM Sending s
WHERE (ConfID = 1) AND (Status = 1)
)
/
(
(
SELECT COUNT(*)
FROM Numbers
WHERE (ConfID = 1)
)
/
100
)
I want to compute percent. For instance, if query
SELECT COUNT(*)
FROM Numbers
WHERE (ConfID = 1)
gives 100 and the another one
SELECT COUNT(*)
FROM Sending s
WHERE (ConfID = 1) AND (Status = 1)
results 50 the result query should return 50, which means 50%. But is first query results with 2 and second returns 10000 the result query returns 0. I think I should define somehow to return float number or so on.
Thanks!
Try dividing by
100.0instead of100. That will force a cast to floating point data type: