Group By element ID and continuous date range as a single row - URGENT!!!!

Hi All,
I have a source table and a target table.
Source Table Target Table
Element ID Period_dt Element ID Effective date End date
DD001 200901 DD001 200901 200903
DD001 200902 DD001 200906 200908
DD001 200903 DD002 200801 200803
DD001 200906
DD001 200907
DD001 200908
DD002 200801
DD002 200802
DD002 200803
I want the result as in the target table. Basically, continuous date range should be grouped and shown as single row even it falls under the same elment_id.
I have tried the LAG and LEAD function and RANK function as well but unsuccessful.
I was able to get like this in the target table using MIN and MAX function.
DD001 200901 200908
DD002 200801 200803
For DD001, you can see there is a break in the months. 200901 - 200903 and 200906 - 200908. we are missing 4th,5th month. 1 to 3rd month and 6th to 8th month should be grouped and shown as separate rows in the target table for the same DD001 element_ID
I will post the SQL query tommorrow. Please give your suggestions.
Regards
Balaji

Thanks guys. It worked perfectly. I apologize for using the 'U' word. This is my first post here.
select prod_element_cd,
min(period_dt) effective_date,
max(Last_day(period_dt)) end_date,
SUM(Fixed_factor),
SUM(var_factor),
val1
from (
select prod_element_cd, period_dt,Fixed_factor,var_factor, val, last_value(val ignore nulls) over(partition by prod_element_cd order by period_dt) val1
from (
select prod_element_cd,
period_dt,
NVL(Fixed,0) Fixed_factor,
NVL(variable,0) var_factor,
lag(period_dt) over(partition by prod_element_cd order by period_dt) dt,
case when add_months(period_dt,-1) = lag(period_dt) over(partition by prod_element_cd order by period_dt)
then null
else rownum end val
from pmax_land.TMP_COST_CASH_STD_INPUT)
group by prod_element_cd, val1
order by prod_element_cd
The above query pulls the below result
PROD_ELEMENT_CD EFFECTIVE_DATE END_DATE FIXED VARIABLE VAL1
DDA001 01/01/2009 03/31/2009 4.20 7.62 1.00
DDA001 06/01/2009 11/30/2009 4.80 0.72 10.00
DDA001 01/01/2010 01/31/2010 0.75 0.50 13.00
DDA002 07/01/2008 09/30/2008 2.40 0.36 11.00
DDA002 02/01/2008 03/31/2008 1.50 1.00 14.00
one more logic added to the requirement
for each occurance, for eg: DDA001, the last row of DDA001 should be taken and the end_date of that should be hardcoded to 12/31/9999
here we have two cases
last row for DDA001 end_date
DDA001 01/01/2010 01/31/2010 0.75 0.50 13.00
end date is 01/31/2010 for this above row of DDA001. It should be hardcoded to 12/31/9999
similarly
last row for DDA002 end_date
DDA002 02/01/2008 03/31/2008 1.50 1.00 14.00
end date is 03/31/2008 for this above row of DDA002. It should be hardcoded to 12/31/9999
Similarly for DDA003,DDA004.......... etc
Thanks for your previous replies. Please give your suggestions.
Regards
Balaji
Edited by: user12119826 on Oct 27, 2009 11:49 PM

Similar Messages

  • How to aggregate a column based date column (for weekly single row)?

    How to aggregate a column based date column (for weekly single row)?

    Hi,
    Consider the below statement for daily bases which is ok
    SELECT ID, DATE, SUM(AMOUNT) FROM TABLE_NAME GROUP BY ID, DATE ORDER BY ID, DATE
    The same like the above statement, I want output on weekly, fortnightly, and monthly bases, How to do this? Need your help...

  • Data Populated in a single row??

    Hi,
    I have a requirement as follows:
    Suppose there is a column "A". There many be "n" no. of records for that column "A"
    I want the code logic for this to sum up all the "n"  no. of records,which is of  type amount and to be populated in a single row.
    Ex :
    Column A
    7867.68
    5658.65
    566765.44
    n
    like this "n"  no. of records would be populated (at the runtime).
    I need the output as :
    Column A
    SUM(7867.68 + 5658.65 + 566765.44 + .......n) in a single row.
    Immediate reply would be greatly appreciated.
    Thanks in advance,
    Regards,
    Vamc
    Message was edited by: Manish Kumar : Do not ask for urgent/immediate reply

    Hi vamshi,
    Both Collect and AT END OF.... END AT, we can use for the above requirement.
    Collect Statement:
    LOOP AT IT_TABLE into WA_TABLE.
         COLLECT WA_TABLE TO IT_FINAL.
    ENDLOOP.
    Control Break Statement (AT END OF... END AT):
    If you are using Control break statement, before LOOP Statement, sort the table as shown below.
    "Data Declarations
    DATA: L_END TYPE I VALUE 0,
                L_COUNT TYPE I VALUE 0.
    "Sort the Internal Table
    SORT IT_TABLE BY MATNR.
    LOOP AT IT_TABLE INTO WA_TABLE.
         L_COUNT = L_COUNT + WA_TABLE-VALUE.
         AT END OF MATNR.
              L_END = 1.
         ENDAT.
         IF L_END = 1.
         MOVE CORRESPONDING WA_TABLE to WA_FINAL.
         "Assign Count value
         WA_FINAL-TOTAL  = L_COUNT.
         "Append the value to Internal Table
         APPEND WA_FINAL TO IT_FINAL.
         "Clear WA & Count
         CLEAR: WA_FINAL,
                        L_COUNT,
                        L_END.
         ENDIF.
    ENDLOOP.
    Regards
    Rajkumar Narasimman

  • Formula help - Group totals for more than one date range

    Post Author: melcaylor
    CA Forum: Formula
    I need to show in 3 columns
    inside of a grouping that totals an amount field based on a date
    range that amount was posted.  So for example:
    Billy Bob in the state of MA made $5.5m total, $800k in the last 21 days, $400k in the last 14 days and $150k in
    the last 7 days.
    I assume this is possible but I
    just donu2019t know what type of formula to write to make it work.  For this
    example, there are 2 tables u2013 user table and $$ table.  The User table has
    the user name, the $$ table has the pay date and the amount. 

    Post Author: SKodidine
    CA Forum: Formula
    You only need simple formulae in Running Totals to accomplish this.
    1.  Group by Name
    2.  Create the following Running Totals:
    2.1 A running total to sum the pay amount for all records, and resets on 'Change of Group' of Name.
    2.2 A running total to sum the pay amount and for 'Evaluate' click on the radio button next to 'Use a formula' and then click on X-2 button next to it.
    In the formula workshop window type a formula such as: {table.payment_date} in (currentdate - 21) to currentdate;
    For 'Reset' click on the radio button next to 'On change of group' and pick the group name.
    2.3 Create another running total just as in step 2.2 above but change the formula to: {table.payment_date} in (currentdate - 14) to currentdate;
    2.4 Create the last running total just as in step 2.2 above but change the formula to: {table.payment_date} in (currentdate - 7) to currentdate;
    Hide the details section and in the group footer place text boxes with appropriate text and insert these running totals to give you the numbers you want.
    The only issue I see with this is if a person was paid yesterday a sum of $25, then it will show $25 for total, last 7days, last 14days and also for last 21days.  At first look it might be mistaken for $75.

  • Can anyone explain the split and overlapping date ranges in PHOTO moments.  I would have expected each date to have its own slot.  What logic is used for deciding which photos to include and where to split them?

    iPad Air iOS 8.1 Stock Photo App.  14000 Photos. Overlapping date ranges in Moments.  What is the criteria used for deciding after import where photos are included in Moments.  I was expecting each day to have its own exclusive slot for example, not 26 - 27 January 2007 with 8 photos then 27 January 2007 1 photo.  Why is there not two seperate slots, one for the 26th and one for 27th??   This makes locating photos by day more arkward than it need be and seems to follow no logic.  This occurs over 150 times and is very confusing.  Is this an issue or expected behaviour?

    iPad Air iOS 8.1 Stock Photo App.  14000 Photos. Overlapping date ranges in Moments.  What is the criteria used for deciding after import where photos are included in Moments.  I was expecting each day to have its own exclusive slot for example, not 26 - 27 January 2007 with 8 photos then 27 January 2007 1 photo.  Why is there not two seperate slots, one for the 26th and one for 27th??   This makes locating photos by day more arkward than it need be and seems to follow no logic.  This occurs over 150 times and is very confusing.  Is this an issue or expected behaviour?

  • How to achieve the from and to date range in report builder 3.

    I AM TRYING TO CREATE ONE REPORT FROM REPORT BUILDER 3.
    WHERE I AM UNABLE TO DEFINE THE DATE RANGE.
    HOW TO ACHIEVE THE DATE RANGE IN REPORT BUILDER.
    NEED FROM DATE AND TO DATE FILTER IN REPORT BUILDER FOR PK DATE.

    Hi Ganesh,
    According to your description, you create a report in Report Builder 3.0, and create two parameters FromDate and EndDate, now you want to use the parameters in your MDX query, right?
    If in this case, here is a sample query for your reference.
    select
    {[Measures].[Internet Sales Amount]
    } on columns,
    {[Date].[Date].members} on rows
    from(
    select
    STRTOMEMBER("[Date].[Date].&["+@StartDate+"]"):STRTOMEMBER("[Date].[Date].&["+@EndDate+"]")
    ) on columns
    from [Adventure Works]
    Reference:STRTOMEMBER
    Regards,
    Charlie Liao
    TechNet Community Support

  • Left outer join using date range returns too many rows

    I am trying to pull data for a website.
    Names table:
    company_name varchar2(30)
    julian_day varchar2(3)
    logins number(3)
    login_errors number(3)
    Given a julian date range (e.g. 250-252), I am displaying the information from the Names table.
    The problem is that I also need to display changes (increases/decreases) in the data. I do that by coloring the text based on a 10% increase/decrease. Data for the 3 days 250-252 would be compared to data for the previous 3 days 247-249.
    Not all companies will report data on all days, so some gaps in the data may exist. Therefore, I cannot do just a simple join.
    I am trying to write a query that will give me this information if the user chooses days 250-252.
    Company_name
    sum(logins) for days 250-252
    sum(login_errors) for days 250-252
    sum(logins) for days 247-249
    sum(login_errors) for days 247-249
    The query I'm using is:
    select cur.company_name, sum(cur.logins),
    sum(cur.login_errors), sum(old.logins), sum(old.login_errors)
    FROM names cur LEFT OUTER JOIN names old
    ON cur.company_name = old.company_name
    WHERE cur.adate>='250' and cur.adate<='252'
    and old.adate>='247' and old.adate<='249'
    GROUP by cur.company_name
    Given this data:
    Company_name adate logins login_errors
    ABC 247 10 10
    ABC 248 20 20
    ABC 249 30 30
    ABC 250 15 15
    ABC 251 25 25
    ABC 252 35 35
    My problem is that it returns:
    adate cur.logins cur.login_err old.logins old.login_err
    250 15 15 60 60
    251 25 25 60 60
    252 35 35 60 60
    How can I get it to only give me the one "old" day's data? I went with the LEFT OUTER JOIN because it's possible that there is no data for an "old" day.
    Thanks in advance.....

    Your problem stems from the join itself, and would be the same even without the OUTER JOIN. With your data, there are 3 records in cur and 3 records in old. The join matches each record in cur to each record in old resulting in 9 records in total. Without the SUM, this is clear:
    SQL> SELECT cur.company_name, cur.logins, cur.login_errors,
      2         old.logins, old.login_errors, cur.adate cad, old.adate oad
      3  FROM names cur LEFT OUTER JOIN names old
      4                 ON cur.company_name = old.company_name
      5  WHERE cur.adate>=250 and cur.adate<=252 and
      6        old.adate>=247 and old.adate<=249;
    COMPANY_NA     LOGINS LOGIN_ERRORS     LOGINS LOGIN_ERRORS        CAD        OAD
    ABC                35           35         10           10        252        247
    ABC                25           25         10           10        251        247
    ABC                15           15         10           10        250        247
    ABC                35           35         20           20        252        248
    ABC                25           25         20           20        251        248
    ABC                15           15         20           20        250        248
    ABC                35           35         30           30        252        249
    ABC                25           25         30           30        251        249
    ABC                15           15         30           30        250        249
    9 rows selected.You can do this with only one reference to the table.
    SELECT company_name,
           SUM(CASE WHEN adate BETWEEN 250 and 252 THEN logins ELSE 0 END) curlog,
           SUM(CASE WHEN adate BETWEEN 250 and 252 THEN login_errors ELSE 0 END) curerr,
           SUM(CASE WHEN adate BETWEEN 247 and 249 THEN logins ELSE 0 END) oldlog,
           SUM(CASE WHEN adate BETWEEN 247 and 249 THEN login_errors ELSE 0 END) olderr
    FROM names
    WHERE adate BETWEEN 247 and 252
    GROUP BY company_nameHTH
    John

  • How to prompt date range for a single column in reports

    Hi All,
    I am having a prompt which shows from date and to date, both these columns will come from day column of calendar .We want that our report values should be between the from date and to date.Can someone tell me how can this be achieved.Because if we build a report we will pull day column from calendar and say its prompted.How can we get the condition that day clumn should be between from date and to date of prompt.
    Thanks and Regards,
    Amrit

    Hi vineet,
    Thanks for your reply
    I am having one prompt where we will have two columns from date and to date, both these columns are coming from same column called day in mth_calendar.I am having 1 report where the date range should lie between from date and to date of prompt.In this case should I use your second suggestion or the first one.
    Thanks,
    Amrit

  • Matser and trasactional data upload thru  a single process chain

    Hi,
    is it possible to automize  both master data and transactional data in a single process chain?i mean to say can we design a  process chain so that we can automize transaction and master data together?
    if yes, can any one send me the steps and process blocks?
    i have in master data one text and one hioerarchy and transactional data!
    Thanks,
    Ravi

    Hi Ravi,
    We can load the 2 types of Data through a Process chain.
    1. Create start variant.
    2. Drag n drop Execute Info Pack from left side panel ( Load Process and post Processing ). Slect ur text Info Package.
    Do the same and select Hier Info Package.
    Place all the Files on Application server AL11.
    3. Drag n drop Collection process AND
    4. Drag n drop Execute Info Pack from left side panel ( Load Process and post Processing ). Slect ur Transaction Data Info Package.
    5. Establish a connection between Master Data Info Packages and Transaction Data Info Packages using AND.
    By this ur specifying that load Master data first, if it is successful load Transaction data.
    6. Goto Start variant > Maintain Variant.  Schedule it according to ur time like when u want to start like Immediately / After Job / After Event.
    Assign points if it is helpful.

  • Data Merge Repeating a Single Row

    I've been trying to use data merge and found it very useful. The only problem is, for no reason I can see, data merge is repeating row 8 from my document. Here is what happens:
    I create a csv file from a 22 row Excel spreadsheet.
    I use data merge to create a multiple record document. The preview looks fine, all records are correct!
    I create the document, and all of a sudden almost all the entries use the data from row 8. The document contains the correct number of entries, they are just almost all a repeat of row 8.
    And here something strange - row 1-3 show up as row 8, then rows 4-9 show up fine, and then the rest (up to the final row 22) show up as row 8 again.
    I've tried switch row 8 with another row, but no matter what the content is it continues to repeat row 8 - including if it is blank. Any help would be appreciated. I am new to data merge so I may be doing something airheaded.

    What version of ID are you using?
    There were some issues like this that cropped up in early releases of CS4, so be sure you've downloaded the patches. If that still doesn't solve the problem, it could be an odd character or somthing similar (too many fields or not enough fields) in one of the records, so open the data file in a plain text editor, look it over, and resave.
    Unfortunately, I've also seen data files that just didn't work in CS4, for no reason anyone was able to find.

  • Support date range and as of date in Universe

    Hi,
    I have some questions on Universe design best practices. Can you please help ?
    We are using BO4 SP7 and UDT for universe design.
    Little bit on our schema: snow flake schema with multiple fact tables. Most of our table are 'Pure Type 6' dimension tables in which start date and end date are used to track historical data.  We also have date dimension table. We want to support both 'As of date' and custom 'date range' type reporting.
    Out typical use cases are like
    1. All items As of date
    2. All items between dates etc.
    How can we model it in the Universe ?
    1. We can not join every dimension with date_d dimension. So we have decided to put default conditions at Folder level. Our typical date conditions as below.
    date_d.end_full_date_utc  between  diminetion1_d.start_date AND diminetion1_d.end_date
    But problem is, table condition are not always applied. If we have A, B and C folders and if I create report by using objects from A and C then non of the condition applied to B appears in the query. This is problem for us.
    2. Other approach we thought is to define start and end prompt and define a restriction condition  for each and every table.
          diminetion1_d.start_date > [start_date_prompt] AND diminetion1_d.end_date < [end_date_prompt]
    We thought it will be too munch work as we have more than 150 tables and also 2 prompts will always appear, even of as of date, which may not look good.
    3. Is there a way apply to apply these date conditions at the individual table level so that they will appear in Query when ever the table is involved in the join path ?
    3. What is the best way to handle this kind of requirements, please suggest ?
    Thanks

    Hi,
    I have some questions on Universe design best practices. Can you please help ?
    We are using BO4 SP7 and UDT for universe design.
    Little bit on our schema: snow flake schema with multiple fact tables. Most of our table are 'Pure Type 6' dimension tables in which start date and end date are used to track historical data.  We also have date dimension table. We want to support both 'As of date' and custom 'date range' type reporting.
    Out typical use cases are like
    1. All items As of date
    2. All items between dates etc.
    How can we model it in the Universe ?
    1. We can not join every dimension with date_d dimension. So we have decided to put default conditions at Folder level. Our typical date conditions as below.
    date_d.end_full_date_utc  between  diminetion1_d.start_date AND diminetion1_d.end_date
    But problem is, table condition are not always applied. If we have A, B and C folders and if I create report by using objects from A and C then non of the condition applied to B appears in the query. This is problem for us.
    2. Other approach we thought is to define start and end prompt and define a restriction condition  for each and every table.
          diminetion1_d.start_date > [start_date_prompt] AND diminetion1_d.end_date < [end_date_prompt]
    We thought it will be too munch work as we have more than 150 tables and also 2 prompts will always appear, even of as of date, which may not look good.
    3. Is there a way apply to apply these date conditions at the individual table level so that they will appear in Query when ever the table is involved in the join path ?
    3. What is the best way to handle this kind of requirements, please suggest ?
    Thanks

  • Date range

    Hi,
    How do I group by to have a date range count and it will sum up the letter1 that is obtained from that one month.Currently i knwo how to run it daily but summarizing by one month of teh postcodes, i am not too sure.
    This is table counters.
    Date Postcode Letter1 Letter2
    31/05/2009     810     MOM MOM
    1/01/2009     810     MOM MOM
    1/02/2009      810     MOM MOM
    29/05/2009     812     DAD DAD
    30/04/2009     832     DAD
    31/05/2009     835     DAD
    29/05/2009     812     MOM
    29/05/2009     812     MOM MOM
    DDL
    create table counters
    (DATETIME date,
    Postcode number,
    letter1 varchar2(5),
    letter 2 varchar2(5));
    Query I have tried:
    <pre>
    SELECT TO_CHAR(DATETIME, 'DD/MM/YY'),POSTCODE,
    count(letter1) as letter1_TOTAL,
    count(letter2) as letter2_TOTAL,
    sum(case when letter1 ='MOM' then 1 else 0 end) as "MOM",
    sum(case when letter2 ='DAD' then 1 else 0 end) as "DATE"
    FROM counters
    WHERE DATETIME >= (sysdate -180)
    GROUP BY TO_CHAR(DATETIME, 'DD/MM/YY'),POSTCODE
    ORDER BY TO_CHAR (DATETIME,'DD/MM/YY') DESC;
    </pre>
    Not sure how to do this month based.
    Liek my expected results should be
    Date Postcode letter1 letter2
    1/01/2009 -1/02/2009 810 2 null --------->MOM occured twice in that month
    1/03/2009 -1/04/2009 810 null null
    1/05/2009 -1/06/2009 810 1 null
    1/01/2009 -1/02/2009 812 null null
    1/03/2009 -1/04/2009 812 null null
    1/05/2009 -1/06/2009 812 1 1
    At that one month how many times MOM/DAD has summed up in that postcode.
    Edited by: CrackerJack on Jun 3, 2009 10:30 PM

    Still not very clear about our requirement.
    SQL> WITH counters AS
      2       (SELECT TO_DATE ('31/05/2009', 'DD/MM/YYYY') datetime, 810 postco
      3               'MOM' letter1, 'MOM' letter2
      4          FROM DUAL
      5        UNION ALL
      6        SELECT TO_DATE ('1/01/2009', 'DD/MM/YYYY'), 810, 'MOM', 'MOM'
      7          FROM DUAL
      8        UNION ALL
      9        SELECT TO_DATE ('1/02/2009', 'DD/MM/YYYY'), 810, 'MOM', 'MOM'
    10          FROM DUAL
    11        UNION ALL
    12        SELECT TO_DATE ('29/05/2009', 'DD/MM/YYYY'), 812, 'DAD', 'DAD'
    13          FROM DUAL
    14        UNION ALL
    15        SELECT TO_DATE ('30/04/2009', 'DD/MM/YYYY'), 832, 'DAD', NULL
    16          FROM DUAL
    17        UNION ALL
    18        SELECT TO_DATE ('31/05/2009', 'DD/MM/YYYY'), 835, 'DAD', NULL
    19          FROM DUAL
    20        UNION ALL
    21        SELECT TO_DATE ('29/05/2009', 'DD/MM/YYYY'), 812, 'MOM', NULL
    22          FROM DUAL
    23        UNION ALL
    24        SELECT TO_DATE ('29/05/2009', 'DD/MM/YYYY'), 812, 'MOM', 'MOM'
    25          FROM DUAL)
    26  SELECT * FROM COUNTERS
    27  ORDER BY datetime
    28  /
    DATETIME    POSTCODE LET LET
    01-JAN-09        810 MOM MOM
    01-FEB-09        810 MOM MOM
    30-APR-09        832 DAD
    29-MAY-09        812 MOM MOM
    29-MAY-09        812 DAD DAD
    29-MAY-09        812 MOM
    31-MAY-09        835 DAD
    31-MAY-09        810 MOM MOM
    8 rows selected.I changed your group by clause to include the date range. However if you want month wise you should understand that 01-Jan-2009 to 31-Jan 2009 is considered as one month. So the date range for one month you specified in your expected result was wrong. (01-Jan-2009 to 01-Feb-2009) .
    Hope the following code helps:
    SQL> WITH counters AS
      2       (SELECT TO_DATE ('31/05/2009', 'DD/MM/YYYY') datetime, 810 postco
      3               'MOM' letter1, 'MOM' letter2
      4          FROM DUAL
      5        UNION ALL
      6        SELECT TO_DATE ('1/01/2009', 'DD/MM/YYYY'), 810, 'MOM', 'MOM'
      7          FROM DUAL
      8        UNION ALL
      9        SELECT TO_DATE ('1/02/2009', 'DD/MM/YYYY'), 810, 'MOM', 'MOM'
    10          FROM DUAL
    11        UNION ALL
    12        SELECT TO_DATE ('29/05/2009', 'DD/MM/YYYY'), 812, 'DAD', 'DAD'
    13          FROM DUAL
    14        UNION ALL
    15        SELECT TO_DATE ('30/04/2009', 'DD/MM/YYYY'), 832, 'DAD', NULL
    16          FROM DUAL
    17        UNION ALL
    18        SELECT TO_DATE ('31/05/2009', 'DD/MM/YYYY'), 835, 'DAD', NULL
    19          FROM DUAL
    20        UNION ALL
    21        SELECT TO_DATE ('29/05/2009', 'DD/MM/YYYY'), 812, 'MOM', NULL
    22          FROM DUAL
    23        UNION ALL
    24        SELECT TO_DATE ('29/05/2009', 'DD/MM/YYYY'), 812, 'MOM', 'MOM'
    25          FROM DUAL)
    26  SELECT      TO_CHAR (TRUNC (datetime, 'MONTH'), 'DD/MM/YYYY')
    27           || '-'
    28           || TO_CHAR (LAST_DAY (datetime), 'DD/MM/YYYY') date_range,
    29           postcode, COUNT (letter1) AS letter1_total,
    30           COUNT (letter2) AS letter2_total,
    31           SUM (CASE
    32                   WHEN letter1 = 'MOM'
    33                      THEN 1
    34                   ELSE 0
    35                END) AS "MOM", SUM (CASE
    36                                       WHEN letter2 = 'DAD'
    37                                          THEN 1
    38                                       ELSE 0
    39                                    END) AS "DAD"
    40      FROM counters
    41     WHERE datetime >= (SYSDATE - 180)
    42  GROUP BY    TO_CHAR (TRUNC (datetime, 'MONTH'), 'DD/MM/YYYY')
    43           || '-'
    44           || TO_CHAR (LAST_DAY (datetime), 'DD/MM/YYYY'),
    45           postcode
    46  ORDER BY    TO_CHAR (TRUNC (datetime, 'MONTH'), 'DD/MM/YYYY')
    47           || '-'
    48           || TO_CHAR (LAST_DAY (datetime), 'DD/MM/YYYY')
    49  /
    DATE_RANGE              POSTCODE LETTER1_TOTAL LETTER2_TOTAL        MOM         DAD
    01/01/2009-31/01/2009        810             1             1          1           0
    01/02/2009-28/02/2009        810             1             1          1           0
    01/04/2009-30/04/2009        832             1             0          0           0
    01/05/2009-31/05/2009        810             1             1          1           0
    01/05/2009-31/05/2009        812             3             2          2           1
    01/05/2009-31/05/2009        835             1             0          0           0
    6 rows selected.Regards,
    Jo
    Edit: Added code tags

  • Neen help with date range searches for Table Sources

    Hi all,
    I need help, please. I am trying to satisfy a Level 1 client requirement for the ability to search for records in crawled table sources by a date and/or date range. I have performed the following steps, and did not get accurate results from Advanced searching for date. Please help me understand what I am doing wrong, and/or if there is a way to define a date search attribute without creating a LOV for a date column. (My tables have 500,00 rows.)
    I am using SES 10.1.8.3 on Windows 32.
    My Oracle 10g Spatial Table is called REPORTS and this table has the following columns:
    TRACKNUM Varchar2
    TITLE Varchar2
    SUMMARY CLOB
    SYMBOLCODE Varchar2
    Timestamp Date
    OBSDATE Date
    GEOM SDO_GEOMETRY
    I set up the REPORTS table source in SES, using TRACKNUM as the Primary Key (unique and not null), and SUMMARY as the CONTENT Column. In the Table Column Mappings I defined TITLE as String and TITLE.
    Under Global Settings > Search Attributes I defined a new Search Attribute (type Date) called DATE OCCURRED (DD-MON-YY).
    Went back to REPORTS source previously defined and added a new Table Column Mapping - mapping OBSDATE to the newly defined DATE OCCURRED (DD-MON-YY) search attribute.
    I then modified the Schedule for the REPORTS source Crawler Policy to “Process All Documents”.
    Schedule crawls and indexes entire REPORTS table.
    In SES Advanced Search page, I enter my search keyword, select Specific Source Group as REPORTS, select All Match, and used the pick list to select the DATE OCCURRED (DD-MON-YY) Attribute Name, operator of Greater than equal, and entered the Value 01-JAN-07. Then the second attribute name of DATE_OCCURRED (DD-MON-YY), less than equals, 10-JAN-07.
    Search results gave me 38,000 documents, and the first 25 I looked at had dates NOT within the 01-JAN-07 / 10-JAN-07 range. (e.g. OBSDATE= 24-MAR-07, 22-SEP-), 02-FEB-08, etc.)
    And, none of the results I opened had ANY dates within the SUMMARY CLOB…in case that’s what was being found in the search.
    Can someone help me figure out how to allow my client to search for specific dated records in a db table using a single column for the date? This is a major requirement and they are anxiously awaiting my solution.
    Thanks, in advance….

    raford,
    Thanks very much for your reply. However, from what I've read in the SES Admin Document is that (I think) the date format DD/MM/YYYY pertains only to searches on "file system" sources (e.g. Word, Excel, Powerpoint, PDF, etc.). We have 3 file system sources among our 25 total sources. The remaining 22 sources are all TABLE or DATABASE sources. The DBA here has done a great job getting the data standardized using the typical/default Oracle DATE type format in our TABLE sources (DD-MON-YY). Our tables have anywhere from 1500 rows to 2 million rows.
    I tested your theory that the dates we are entering are being changed to Strings behind the scenes and on the Advanced Page, searched for results using OBSDATE equals 01/02/2007 in an attempt to find data that I know for certain to be in the mapped OBSDATE table column as 01-FEB-07. My result set contained data that had an OBSDATE of 03-MAR-07 and none containing 01-FEB-07.
    Here is the big issue...in order for my client to fulfill his primary mission, one of the top 5 requirements is that he/she be able to find specific table rows that are contain a specific date or range of dates.
    thanks very much!

  • Need help with date range searches for Table Sources in SES

    Hi all,
    I need help, please. I am trying to satisfy a Level 1 client requirement for the ability to search for records in crawled table sources by a date and/or date range. I have performed the following steps, and did not get accurate results from Advanced searching for date. Please help me understand what I am doing wrong, and/or if there is a way to define a date search attribute without creating a LOV for a date column. (My tables have 500,00 rows.)
    I am using SES 10.1.8.3 on Windows 32.
    My Oracle 10g Spatial Table is called REPORTS and this table has the following columns:
    TRACKNUM Varchar2
    TITLE Varchar2
    SUMMARY CLOB
    SYMBOLCODE Varchar2
    Timestamp Date
    OBSDATE Date
    GEOM SDO_GEOMETRY
    I set up the REPORTS table source in SES, using TRACKNUM as the Primary Key (unique and not null), and SUMMARY as the CONTENT Column. In the Table Column Mappings I defined TITLE as String and TITLE.
    Under Global Settings > Search Attributes I defined a new Search Attribute (type Date) called DATE OCCURRED (DD-MON-YY).
    Went back to REPORTS source previously defined and added a new Table Column Mapping - mapping OBSDATE to the newly defined DATE OCCURRED (DD-MON-YY) search attribute.
    I then modified the Schedule for the REPORTS source Crawler Policy to “Process All Documents”.
    Schedule crawls and indexes entire REPORTS table.
    In SES Advanced Search page, I enter my search keyword, select Specific Source Group as REPORTS, select All Match, and used the pick list to select the DATE OCCURRED (DD-MON-YY) Attribute Name, operator of Greater than equal, and entered the Value 01-JAN-07. Then the second attribute name of DATE_OCCURRED (DD-MON-YY), less than equals, 10-JAN-07.
    Search results gave me 38,000 documents, and the first 25 I looked at had dates NOT within the 01-JAN-07 / 10-JAN-07 range. (e.g. OBSDATE= 10-MAR-07, 22-SEP-07, 02-FEB-08, etc.)
    And, none of the results I opened had ANY dates within the SUMMARY CLOB…in case that’s what was being found in the search.
    Can someone help me figure out how to allow my client to search for specific dated records in a db table using a single column for the date? This is a major requirement and they are anxiously awaiting my solution.
    Thanks very much, in advance….

    raford,
    Thanks very much for your reply. However, from what I've read in the SES Admin Document is that (I think) the date format DD/MM/YYYY pertains only to searches on "file system" sources (e.g. Word, Excel, Powerpoint, PDF, etc.). We have 3 file system sources among our 25 total sources. The remaining 22 sources are all TABLE or DATABASE sources. The DBA here has done a great job getting the data standardized using the typical/default Oracle DATE type format in our TABLE sources (DD-MON-YY). Our tables have anywhere from 1500 rows to 2 million rows.
    I tested your theory that the dates we are entering are being changed to Strings behind the scenes and on the Advanced Page, searched for results using OBSDATE equals 01/02/2007 in an attempt to find data that I know for certain to be in the mapped OBSDATE table column as 01-FEB-07. My result set contained data that had an OBSDATE of 03-MAR-07 and none containing 01-FEB-07.
    Here is the big issue...in order for my client to fulfill his primary mission, one of the top 5 requirements is that he/she be able to find specific table rows that are contain a specific date or range of dates.
    thanks very much!

  • Crosstab or Crosstabs with different date ranges not lining up.

    I have a crosstab with a dimension (item) in the vertical axis, and different date ranges on the Horizontal (top) axis.
    I want to display counts of a measure over specific ranges of time. For instance, count of items sold for weeks 1,2,3,4, horizontally, then count of items sold for months 1,2,3,4 horizontally, next to each other.
    Problem is that count rows by item do not line up. Count by week has fewer items, so it has fewer rows than the counts by month. I need it to have the same number of rows, and just show 0 or blank in that row, instead of just not being there. I need all rows to line up by item.
    Its like there needs to be an outer join, but I haven't been able to make it work. What am I missing?
    Does that make sense?
    Any ideas welcome. Thank you!

    Wavery,
    You are looking to display a grid with a high degree of consistency, regardless of the data present.  There is no "single" step capability provided by WebI to achieve this, so it requires creativity on your part.  A second data provider (DP) for your report is necessary and can be either a view in your database, a custom SQL, or some folks have even built a derived table in their universe to accommodate.  At any rate, there are one of two ways to achieve.  If you are familar with SQL and the "union" statement, you would run the basic SQL, then via union, dummy up a second query that has all the requisite columns, but for the measures you would use a value of zero so as not to affect the generated facts.  For example, suppose you had a report for a hardware store, and you wanted to track the following items:  Nails, Flashlights, and Screws.  Your basic query might look like this:
    select item,sum(inventory) from inventory_table where item in ('nail','flashlight','screw') group by item
    Then your next portion of code:
    union select 'Nail',0 union select 'Flashlight',0 union select 'Screw',0
    See how the union is providing "dummy" info?  To do this in WebI with a second DP, you would not use union, but a separate view perhaps, then in WebI apply Merge Dimensions on the item column (and the equivalent of an outer join).
    Thanks,
    John

Maybe you are looking for

  • Webi Report on BW Universe works in DEV but not properly in TEST

    Hi, We have created a Webi-Report on a BW Universe on our DEV server. Everything works like a charm and we are prompted as the first thing for keydate and the report is refreshed successfully. We then export the Universe (no connection overwrite) and

  • HT5625 How can I delete an Apple ID account? I exigently have two.

    Hi there I am wondering how I can delete one of my Apple ID's. Apperiantly I have two diffrent emails attatched to two diffrent ID's, but I would like to combine the emails to only one Account. How can a mange that? Best regards, Signy Johannesdottir

  • Creating WebService using Jdeveloper 9i

    Is there a article on creating PLSQL Webservice using Jdeveloper 9i(9.0.3.5) and then porting it on the Application server? We have Oracle Application 11.5.10 using 10g database. Thanks PHK

  • Third Party Sales-Automatic PO generation

    Hi I am using Item cat.TAS & Automatic PO Generation is ticked in TAS. Schedule line cat. CS.but automatic PR is  getting generated & PO is not getting generated... Pls help... Amol

  • Macbook pro runs slowly on all applications

    I can't load any web pages, it keeps reloading them 3 times then fails. All applications are slow and some dont even start up. Could it be a virus??? The only change I made last week was to restart the Mac with an SD camera card in the slot. Whats th