Problem Dividing Values with float results
Good morning guys,
I'm having a problem to create a report who counts 2 quantities of a related field. When the results come, the datatype is of course integer for both of then, because of the "Count" function used.
One of the values is always less than the other, and my problem is that I need to divide then by using the lesser value as the numerator and the greater value as the denominator. The result will always be 0 "Zero", because it's using the following query:
COUNT(CAST(COLUMN_NAME AS FLOAT)) / COUNT(CAST(COLUMN_NAME AS FLOAT))
The result would be correct if the syntaxe could by altered by the following
CAST(COUNT(COLUMN_NAME) AS FLOAT) / CAST(COUNT(COLUMN_NAME) AS FLOAT)
I've tried everything to acomplish this result, but I can't convert the result of an calculated field who's using an agregate function even when I tried to use SQL Freehand calculation. I can't use pre defined calculations either, because the 2 columns used in the calculation are from diferent subqueries, and the pre defined calculation can only use columns from the active query.
Can someone help me acomplish this result?
Thanks in advance.
Hi Renato,
I think your best bet here would be to include a *1.0 in your calculation which will implicitly cast all values in the operation to a float:
Let me know if this works for you.
Regards,
Nathan
Hi Renato,
I think your best bet here would be to include a *1.0 in your calculation which will implicitly cast all values in the operation to a float:
Let me know if this works for you.
Regards,
Nathan
Replies have been locked on this page!