How to group by date in Oracle database

I keep forgetting how to do this.

How to group on a date column (date_col in the example) in Oracle:

SELECT count(*) FROM table GROUP ON TO_CHAR(date_col, 'DD-MON-YYYY HH:MI:SS') 

For other format strings than

'DD-MON-YYYY HH:MI:SS'

see this page.

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.