我正在尝试计算变量'ASSESS_WEIGHT'超出四分位数范围(IQR)的实例数。 IQR max和min已经计算并存储在metric_value中,其中metric_description是'MAX_IQR_ASSESS_WEIGHT'和'MIN_IQR_ASSESS_WEIGHT'。 metric_value是十进制数。
SELECT COUNT(*) AS counts, ASSESS_WEIGHT
FROM ASSESSMENT_INSTANCE
WHERE
ASSESS_WEIGHT >= (SELECT metric_value
FROM data_quality
WHERE metric_description = 'MAX_IQR_ASSESS_WEIGHT')
OR
ASSESS_WEIGHT <= (SELECT metric_value
FROM data_quality
WHERE metric_description = 'MIN_IQR_ASSESS_WEIGHT')
我不确定为什么这不起作用。我在Hortonworks Hive查询编辑器的HQL中运行它。
谢谢!