posted 18 years ago
Use of different fields for Year, Month, Day.... is going to make your life miserable.
Right (and only?) way is to use the Date/Time type of that RDBMS.
Assuming that you are using Oracle, the query for your "GROUP BY" hour should look something like this:
select count( to_char(date_field, 'HH')), to_char(date_field, 'HH')) from
your_table GROUP BY to_char(date_field, 'HH'))