-
Junior Member
Group BY Date Range
Hi ,
I need some light on the following issue..
I have a table which has a date field proceed_data.
This table contains about past 6 months data.
I need to select fields from this table on a weekly basis.
I need out put as follows
row1- Week1 column1 column2 column 3 ...
row2- Week2 column1 column2 column 3 ...
row3- Week3 column1 column2 column 3 ...
...
...
Here number of weeks = Number of rows
Can I get using group by clause..or I need to use plsql tables ...
Thanks in Advance
-
Expert Member
Re: Group BY Date Range
No need to use pl sql tables.
Use the following query
select
trunc(CURR_DTE,'WW'),
sum(decode((received_dte - input_dte ),0,1,0)) " 0 days" ,
sum(decode((received_dte - input_dte ),1,1,0)) "<=1days ",
sum(decode((received_dte - input_dte ),2,1,0)) "<=2days ",
sum(decode((received_dte - input_dte ),3,1,0)) "<=3days ",
sum(decode((received_dte - input_dte ),4,1,0)) "<=4days ",
sum(decode((received_dte - input_dte ),5,1,0)) "<=5days ",
sum(decode((received_dte - input_dte ),6,1,0)) "<=6days "
from promise
group by trunc(CURR_DTE,'WW')
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