Home » RDBMS Server » Server Administration » Need help!!!
Need help!!! [message #373523] Fri, 20 April 2001 11:56 Go to next message
CHACKO
Messages: 11
Registered: March 2001
Junior Member
SQL> SELECT * FROM PROJ ORDER BY MDATE;

NAME -- MDATE -- SAL
---------- --------- ----------
CRIS -- 02-APR-01 -- 2000
SMITH -- 03-APR-01 -- 3000
SCOTT -- 03-APR-01 -- 1000
DAVID -- 05-APR-01 -- 2500
SMITH -- 06-APR-01 -- 3500
MARIA -- 08-APR-01 -- 2000
JEFF -- 09-APR-01 -- 1000
BOB -- 10-APR-01 -- 2000
DAVE -- 13-APR-01 -- 3000
BEN -- 15-APR-01 -- 3000

I need to create a report fro this....
How can I extract the name,mdate,sal from every week [[First 5 records in between 01-apr-01 and 07-apr-01 and so on .But there is lot of records in this database start from 2000 to present.]]

THESE ARE THE WEEKS.
01-APR-01 TO 07-APR-01
08-APR-01 TO 14-APR-01
15-APR-01 TO 21-APR-01

Answer
======
CRIS 02-APR-01 2000
SMITH 03-APR-01 3000
SCOTT 03-APR-01 1000
DAVID 05-APR-01 2500
SMITH 06-APR-01 3500

MARIA 08-APR-01 2000
JEFF 09-APR-01 1000
BOB 10-APR-01 2000
DAVE 13-APR-01 3000

BEN 15-APR-01 3000

Anybody Please help how to write a sql query or function for this?
because function we can call from sql statement.
Thanks in advance...
Need help!!! [message #373554 is a reply to message #373523] Mon, 23 April 2001 10:39 Go to previous messageGo to next message
Vaibhav
Messages: 13
Registered: April 2001
Junior Member
you can fire this query,
select NAME,MDATE,SAL,to_char(MDATE,'WW-YYYY') from PROJ. if you are using D2K for reports, then you can make a group above report and achive the result.
vaibhav.
Re: Need help!!! [message #373571 is a reply to message #373554] Tue, 24 April 2001 04:19 Go to previous message
Vaibhav
Messages: 13
Registered: April 2001
Junior Member
you have to make a group left report or a group above report using D2K report builder. if you are using oracle reports then you can use the "break" feature of sql reporting.
in any way, you can achieve it. i have done it myself yesterday and i can send you the RDF file also if you want. make an SQL and then group it according to the WW-YYYY column. i purposely added the WW-YYYY column as you mentioned that you have data belonging to several years.
please contact me if you have any other problem stating the exact nature of the problem.
vaibhav.
Previous Topic: OPTIMIZE QUERY
Next Topic: Re: Ooopps! Replace Max with Min to retrieve correct result (-)
Goto Forum:
  


Current Time: Mon Dec 23 10:07:38 CST 2024