Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Group resultset day by day
Thanks Jim, I'll test it.
Jim Kennedy wrote:
> "Juliano.net" <juliano.net_at_gmail.com> wrote in message
> news:1158263053.676554.30270_at_m73g2000cwd.googlegroups.com...
> > Hi, I'm searching for a better way to do a procedure that SELECTs some
> > data of a specific month and bring the resultset with the value grouped
> > day by day.
> >
> > My tables:
> >
> > TBL_Activity
> > ---------------------
> > ID_Activity INT
> > NM_Activity VARCHAR
> >
> > TBL_WorkingTime
> > ---------------------
> > ID_WorkingTime
> > DT_DateTime
> > NR_HoursSpent
> > ID_Activity
> >
> > So, I need to get from all the activities (TBL_Activity) the sum of the
> > NR_HoursSpent grouped by every month day.
> >
> > I need to have a resultset like this:
> >
> > ID_Activity | NM_Activity | Day 01 | Day 02 | Day 03 | and son on, up
> > to the last month day | Day 31
> >
> > And for every Day, I get the sum of the NR_HoursSpent for that day.
> >
> > How can I do this?
> >
>
> select id_activity,nm_activity,to_char(dt_dateTime,'dd'),sum(nr_hoursspent)
> from ...
> group by id_activity,nm_activity,to_char(dt_dateTime,'dd') order by
> nm_activity,3 ;
>
> I'll let you figure out the join.
> Jim
Received on Fri Sep 15 2006 - 05:33:17 CDT
![]() |
![]() |