Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Group by week
Information like this is easily found in the manuals. If you would refer to your SQL Manual chapter on functions you will see that the to_char and to_date functions support several WEEK formats including one based on the first day of the year and another based on the ISO standard. Note that in these examples I have not bothered to take differences in years into account.
select to_char(created,'IW') as ISO, count(*)
from dba_objects
group by to_char(created,'IW')
IS COUNT(*)
-- ----------
43 3
44 6
45 5
46 3
49 19
50 20
51 2
select to_char(created,'WW') as "1DAY", count(*)
from dba_objects
group by to_char(created,'WW')
1D COUNT(*)
-- ----------
44 6
45 5
46 3
49 19
50 20
51 2
Please refer to Chapter 4, Functions, Oracle8i SQL Reference for more information.
"Fabio Oliveira Della Santina" <fabio.oliveira_at_edb.ericsson.se> wrote in
message news:3B24B57C.67B807D8_at_edb.ericsson.se...
> Hi all,
>
> I need to build a SQL Query that group data by week, having how exit
> anything like that:
>
> 05-01-2001 -----------
> 05-08-2001 -----------
> 05-15-2001 -----------
>
> Please, anybody can help me with the group by clause ?
>
> Thanks
>
>
>
Received on Mon Jun 11 2001 - 14:53:03 CDT