我有 2 个不同的查询将返回值:1502.00 和 6
SELECT replace(CURRENT_VALUE,'$','') curVal
FROM form_attributes_values
WHERE TEST_ID=2
AND ATTRIBUTE_ID = (
SELECT ATTRIBUTE_ID
FROM form_attributes
WHERE FORM_ID=6
AND FORM_FIELD_NAME='REGRINDABLECUTTERCOST'
)
和
SELECT replace(CURRENT_VALUE,'$','') curVal
FROM form_attributes_values
WHERE TEST_ID=2
AND ATTRIBUTE_ID = (
SELECT ATTRIBUTE_ID
FROM form_attributes
WHERE FORM_ID=6
AND FORM_FIELD_NAME='REGRINDSPOSSIBLE'
)
我正在尝试执行除法 query1/query2 (1502.00/6) 应该返回值250.333333
但我得到的价值是0.16666666666666
以下是尝试过的类型: 类型 1:
select (a.curVal / b.curVal) as final_count
from (
SELECT replace(CURRENT_VALUE,'$','') curVal
FROM form_attributes_values
WHERE TEST_ID=2 AND ATTRIBUTE_ID = (
SELECT ATTRIBUTE_ID
FROM form_attributes
WHERE FORM_ID=6
AND FORM_FIELD_NAME='REGRINDABLECUTTERCOST'
)
) a,
(
SELECT replace(CURRENT_VALUE,'$','') curVal
FROM form_attributes_values
WHERE TEST_ID=2
AND ATTRIBUTE_ID = (
SELECT ATTRIBUTE_ID
FROM form_attributes
WHERE FORM_ID=6
AND FORM_FIELD_NAME='REGRINDSPOSSIBLE'
)
) b;
类型 2:
SELECT replace(CURRENT_VALUE,'$','') / (
SELECT replace(CURRENT_VALUE,'$','') curVal
FROM form_attributes_values
WHERE TEST_ID=2
AND ATTRIBUTE_ID = (
SELECT ATTRIBUTE_ID
FROM form_attributes
WHERE FORM_ID=6
AND FORM_FIELD_NAME='REGRINDSPOSSIBLE'
)
) curVal
FROM form_attributes_values
WHERE TEST_ID=2
AND ATTRIBUTE_ID = (
SELECT ATTRIBUTE_ID
FROM form_attributes
WHERE FORM_ID=6
AND FORM_FIELD_NAME='REGRINDABLECUTTERCOST'
)
两种类型都返回0.166666666666667
我错过了什么......?