我只想从以下工作查询中选择 GAS < 0.9 和 oil < 0.9 的行。
下面的查询工作正常,但我无法检查以仅在 GAS < 0.9 和 oil < 0.9 值时进行选择,因为我已经在使用 groupby ;我不确定获得此结果的最佳方法是什么。
SELECT
rf.DAYTIME,
GEO_FIELD_CODE,
f.NAME,
ROUND(decode(THEOR_GAS_RATE_SM3, 0, NULL, NULL, NULL,ABS(ALLOC_GAS_VOL_SM3/THEOR_GAS_RATE_SM3)),3) AS GAS,
ROUND(decode(THEOR_NET_OIL_RATE_STM3, 0, NULL, NULL, NULL,ABS(ALLOC_NET_OIL_VOL_STM3/THEOR_NET_OIL_RATE_STM3)),3) AS OIL
FROM (SELECT
DAYTIME,
GEO_FIELD_CODE,
SUM(THEOR_GAS_RATE_SM3) AS THEOR_GAS_RATE_SM3,
SUM(ALLOC_GAS_VOL_SM3) AS ALLOC_GAS_VOL_SM3,
SUM(THEOR_NET_OIL_RATE_STM3) AS THEOR_NET_OIL_RATE_STM3,
SUM(ALLOC_NET_OIL_VOL_STM3) AS ALLOC_NET_OIL_VOL_STM3
FROM XYZ
WHERE DAYTIME >= TO_DATE ('2013-01-01', 'yyyy-mm-dd')
GROUP BY DAYTIME, GEO_FIELD_CODE
ORDER BY GEO_FIELD_CODE, DAYTIME) rf, ECKERNEL_HALE.OV_FIELD f
WHERE rf.GEO_FIELD_CODE = f.CODE
任何帮助都感激不尽。