Here is my query
SELECT
Id AS [ID]
IIF(max(ISNULL(c.Value, 1.0)) = 1.0, 0.0, SUM(
CAST((IIF(ISNUMERIC(ISNULL(f.Value, 0.0)) = 1.0, CAST(f.Value AS float), 0.0) /
ISNULL(c.Value, 1.0)) *
60.0 AS float))) AS [Value]
FROM
Form f LEFT JOIN Control c ON f.ID = c.FormID
GROUP BY
f.Id
I get an error:
Arithmetic overflow error converting nvarchar to data type numeric
Does anyone have an idea what's wrong with my code?
Here is my data of Form table and Control table:
tbl_Control:
Id Value FormID
1 12200.0000016 16382
2 0 18864
3 18234
tbl_Form:
ID Value
16382 5
18864 2019-12-24T02:01:05.660Z
318234 Test OK