1502.00と6の値を返す2つの異なるクエリがあります
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
は私が何かを逃しています...?