sql - How to fetch data from oracle database in hourly basis -


i have 1 table in database mytable, contents request coming other source. there 1 column in table time, stores date , time(e.g. 2010/07/10 01:21:43) when request received. want fetch data table on hourly basis each day. means want count of requests database receive in each hours of day. e.g.for 1 o'clock 2 o'clock count 50 ..like this.. run query @ end of day. requests received in day group each hour.

can me in this.

i want query take less time fetch data database size huge.

any othre way omg ponies answer.

use to_char function format datetime column, can group aggregate functions:

  select to_char(t.time, 'yyyy-mm-dd hh24') hourly,          count(*) numperhour     your_table t group to_char(t.time, 'yyyy-mm-dd hh24') 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -