min value for specific time period each day
Hi All,
I have a table which has the value for each hour. I need the minimum value during the time period of 1 am to 5 am. I can get the values for that time period, but when I attempt to get the min value, there appears to multiple values for some days and the values are not the same.
the main table is rt_dy_consumption with the columns timestamp of type date and column cp_ol01_vt with type number(12,6). There are other columns in rt_consumption, but the only two I need are timestamp and cp_ol01_vt
i used the following to get the values
SELECT timestamp, cp_ol01_vt FROM rt_consumption
WHERE to_char(timestamp, 'HH24') BETWEEN 01 AND 05
then I created a view called rt_mintest with the query and tried
SELECT timestamp, MIN(cp_ol01_vt)
FROM rt_mintest
GROUP BY timestamp
but I am getting multiple min values in the results. a sample of the results are
TIMESTAMP MIN(CP_OL01_VT)
---------------------- --------------------------------
2005-10-31 04:00:00 .161783
2006-05-13 02:00:00 .306724
2006-05-13 05:00:00 .305159
My goal was to only get the minimum value for 2006-05-13, but somehow I am getting all the values.
any help would be appreciated.
Thanks
Brad