|
-
Hi,
I have a table with 3 columns
Column Names: id Number
start_date Date
end_date Date
Start_Date & End_Date will contain only dates of SUNDAY's.
For Eg: ID = 1, Start_Date = 16-JUN-2002 , End_Date = 30-JUN-2002
ID = 2, Start_Date = 04-AUG-2002 , End_Date = 25-AUG-2002
Like this there will be more than one record in the table.
My requirement is to split the above record by weeks.
For the above example no. of weeks between 16-JUN-2002 & 30-JUN-2002 is 2 weeks and for 04-AUG-2002 & 24-AUG-2002 is 3 weeks.
So my query should return 2 rows for record 1 and 3 rows for record 2, the records should be split with respect to SUNDAYS as below:
Eg: ID Start_Date End_Date
1 16-JUN-2002 23-JUN-2002
1 23-JUN-2002 30-JUN-2002
2 04-AUG-2002 11-AUG-2002
2 11-AUG-2002 18-AUG-2002
2 18-AUG-2002 25-AUG-2002
This should be done with SELECT statement.
I definitely believe you should have come across this from your experience.
I appreciate your help in advance.
Thanks.
RaviSHankar.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|