Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting records by week

Status
Not open for further replies.

syncdba

IS-IT--Management
Nov 28, 2005
206
US
Hi,
I'm trying to get the records from following table first by day(which I already did), then Total of Emp by "Week" & then Total of Emp by "Month"

Date Emp No Emp_Type
09/10/2006 10 INT
09/10/2006 15 EXT
09/12/2006 7 INT
09/16/2006 6 INT
Weekly Total=38 (How can I get this)....
09/17/2006 7 EXT
09/18/2006 2 EXT
09/23/2006 10 INT
Weekly Total=19 (How can I get this)....
09/28/2006 2 EXT
09/30/2006 10 INT
Weekly Total=12 (How can I get this)....

ANS Them Total MONTH = 69

I would really appreciate if somebody helps me,...
Thanks in advance.



 
Syncdba,

Does this SQL*Plus code come close enough for you:
Code:
clear col
clear break
clear compute
col m noprint
col w noprint
col dt heading "Date" format a20
break on m on w skip 1 on report
compute sum of emp_no on m w
set pagesize 500
select to_char(dt,'mm/dd/yyyy')dt, emp_no, emp_type
      ,to_char(dt,'WW')w, to_char(dt,'mm')m
  from syncdba
 order by dt;

Date                     EMP_NO EMP
-------------------- ---------- ---
09/10/2006                   10 INT
09/10/2006                   15 EXT
09/12/2006                    7 INT
09/16/2006                    6 INT
                     ----------
                             38

09/17/2006                    7 EXT
09/18/2006                    2 EXT
09/23/2006                   10 INT
                     ----------
                             19

09/28/2006                    2 EXT
09/30/2006                   10 INT
                     ----------
                             12

                     ----------
                             69
Let us know

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I can provide you with low-cost, remote Database Administration services: see our website and contact me via www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top