Oracle SQL group by week /month -
how can group reocrds weekly/monthly in oracle between date , date 1 record can returned 1 week/month.
e.g if have 5 records ist weeek , 3 records second week between date , date should return total 2 records(one ist week , 1 second week).
thanks in advance.
you can group results using group by
: http://www.techonthenet.com/oracle/group_by.php
to select between date , date use where
edit
for selecting begining of week or month, can use trunc
(the_date_field, ): http://www.techonthenet.com/oracle/functions/trunc_date.php
for example groups week:
select trunc(datecol_name, 'ww') table_name group trunc(datecol_name, 'ww');
Comments
Post a Comment