Getting aggregated data based on Date in Webi.

Hi,
              I have a requirement to display last 6 Months Receviables Month Wise in Webi. And i am getting data based on clearing Date in Bex query. And data from Bex query will be like
       Month             Measure
     01.01.2014       12
     06.01.2014       15
     15.01.2014       16
    02.02.2014        8
    05.02.2014       10
    12.03.2014        4
    14.03.2014        6
    18.03.2014       10
    21.03.2014        20
    30.03.2014       30
   03.04.2014        30
And i want aggregated data as
Month  Measure
Jan      43
Feb     18
Mar     66
Apr     30

Hi Satish,
Have you tried below:
Create Month1 object as =Month([Month]) and [total]as =Sum([Measure])
Then drag both Month1 and total objects in report block.
Regards,
Yuvraj

Similar Messages

  • How to get fiscal period based on date and Fiscal year?

    Hi Guys,
               Can anybody tell me how to get Fiscal period based on date and Fiscal Year or fiscal year variant?
    Thanks,
    Gopi.

    Hi,
    Please refer the code below:
    *: Report:  ZFISCALYR                                                  :
    *: Date  :  2004                                                       :
    *: Description: Demonstrates how to return the corresponding fiscal    :
    *:              year and posting period for a company code and posting :
    *:              date or posting date and fiscal year variant.          :
    REPORT  zfiscalyr NO STANDARD PAGE HEADING.
    TABLES: ekko.
    PARAMETERS:     p_bukrs TYPE ekko-bukrs,
                    p_bedat TYPE ekko-bedat.
    DATA: gd_fiscalyr  TYPE bapi0002_4-fiscal_year,
          gd_fiscalp   TYPE bapi0002_4-fiscal_period.
    DATA: gd_fiscalyr2 TYPE T009B-BDATJ,
          gd_fiscalp2  TYPE bapi0002_4-fiscal_period.
    DATA: gd_periv     TYPE t009-periv.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    * get fiscal year and period - (requires date and company code)
      CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
        EXPORTING
          companycodeid = p_bukrs
          posting_date  = p_bedat
        IMPORTING
          fiscal_year   = gd_fiscalyr
          fiscal_period = gd_fiscalp.
    * Alternative fiscal year function module
    * - (requires date and fiscal year variant code from T009 table)
    * gets first entry in fiscal year variant table (will need to choose
    * correct one from table rather than just using first entry)
      SELECT SINGLE periv
        FROM t009
        INTO gd_periv.
    * get fiscal year and period
      CALL FUNCTION 'DETERMINE_PERIOD'
        EXPORTING
          date                      = p_bedat
    *    PERIOD_IN                 = '000'
          version                   = gd_periv
       IMPORTING
          period                    = gd_fiscalp2
          year                      = gd_fiscalyr2
       EXCEPTIONS
          period_in_not_valid       = 1
          period_not_assigned       = 2
          version_undefined         = 3
          OTHERS                    = 4.
    *END-OF-SELECTION.
    END-OF-SELECTION.
      WRITE:/ 'From function module: BAPI_COMPANYCODE_GET_PERIOD',
            / 'Fiscal year is:', gd_fiscalyr,
            / 'Fiscal period is:', gd_fiscalp.
      SKIP.
      WRITE:/ 'From function module: DETERMINE_PERIOD',
            / 'Fiscal year is:', gd_fiscalyr2,
            / 'Fiscal period is:', gd_fiscalp2.
    Thanks,
    Sriram Ponna.
    Edited by: Sriram Ponna on Apr 17, 2008 8:59 PM

  • Getting the data based on dates

    Hi All,
    In my application i am not able to retrieve the data from database between two dates.
    while entering the dates i am entring using :
    + "',to_date('+ fromdate+ "','DD-Mon-YYYY HH24:MI:SS'),"
    as in database i have kept my fromdate type as "varchar2"
    So while selecting data i have written the query as :
    String sqlQuery =
                                  "select SID,SERVER_NAME,DOWNTIMETYPE,FROMDATE,TODATE,FROMTIME,TOTIME,TIMETAKEN,DOWN_REASON from SS_UPDOWNTIME where (FROMDATE >='"
    + frmdate
    + "'  OR  (FROMDATE between '"
    + frmdate
    + "' and '"
    + todate
    + "')) ";
    but i am not able to get the data between the two selected dates
    Regards,
    Anupama

    Hi Anupama,
    'between' wont work because you have taken dates as varchar2.
    Just try like this.
    Take "Date" type in database and in java take java.sql.Date
    java.sql.Date sqlDefaultDate = new java.sql.Date(System.currentTimeMillis());
    System.out.println("sqlDate: "+sqlDefaultDate);  
    //  this will be in the format 2008-11-13 , So we can pass sqlDefaultDate variable to backend
    Regards,
    Lakshmi Prasad.

  • Getting past days data based on DATE data type column

    I am trying to extract last 2 days data using date data type column with below query,
    select * from tbl
    where col < col -2;
    this is not showing me any data. please help where i am making mistake. guide please. thx

    Hi,
    When you say "last 2 days" do you mean the 48 hours right before run-time?
    If so, you want to compare col to SYSDATE:
    select  *
    from    tbl
    where   col  >  SYSDATE - 2
    and     col  <= SYSDATE
    ;If you mean the "last 2 days" before some other event, then replace SYSDATE with that date in both places above.
    If you were trying
    where   col  >  col - 2then you should have been getting all rows that have a non-NULL col. If you were getting no results, then something is very wrong.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    If the results depend on when you run the query, then give a couple of different examples, with the run-time. for example "If I run this at 03:00:00 on July 1, 2012, then I should get ... but if I run ir at 15:00:00 on July 1, 2012, then the results should be ...".
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • Problem when sorting data based on date

    I am trying to sort the following data based on the Transaction Receipt date column,unable to do it usi g the following syntax:
    <?sort:TRANSACTION_RECEIPT_DATE;'ascending';data-type='date'?>
    I have problem in converting the date in report to canonical date ,is there any other way to achieve the output without converting the date format.
    <?xml version="1.0"?>
    <!-- Generated by Oracle Reports version 6.0.8.27.0 -->
    <RECDTREP>
    <LIST_G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO104</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>24636</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863063</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO107</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>24641</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863068</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO123</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>24658</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863086</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO75</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>31-MAR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>22190</OBJECT_ID>
    <INITIALIZATION_DATE>14-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510860842</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>31-Mar-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>971515</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO116</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>64271</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863077</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO92</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>31-MAR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>22253</OBJECT_ID>
    <INITIALIZATION_DATE>14-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510860890</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>31-Mar-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>971515</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO99</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>31-MAR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>22263</OBJECT_ID>
    <INITIALIZATION_DATE>14-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510860899</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>31-Mar-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>971515</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO109</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>64204</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863070</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO135</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/18 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>64296</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510875546</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO101</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>24618</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863046</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO120</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>24653</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863081</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO122</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>24657</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863085</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO127</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>24662</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863090</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO100</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>07-APR-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1></SNO_ATTRIBUTE1>
    <OBJECT_ID>24585</OBJECT_ID>
    <INITIALIZATION_DATE>07-APR-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863033</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO110</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/11 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>64265</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510863071</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    <G_ASW_REC_DATE>
    <SNO_CREATED_BY>1433</SNO_CREATED_BY>
    <SNO_REQUEST_ID>-1</SNO_REQUEST_ID>
    <VENDOR_LOT_NUM>PO130</VENDOR_LOT_NUM>
    <SNO_CREATION_DATE>25-JUN-09</SNO_CREATION_DATE>
    <SNO_ATTRIBUTE1>2008/06/13 00:00:00</SNO_ATTRIBUTE1>
    <OBJECT_ID>64275</OBJECT_ID>
    <INITIALIZATION_DATE>30-JUN-09</INITIALIZATION_DATE>
    <ORGANIZATION_CODE>10</ORGANIZATION_CODE>
    <ORGANISATION_NAME>NDC - PARTS</ORGANISATION_NAME>
    <SERIAL_NUMBER>6510875487</SERIAL_NUMBER>
    <ITEM_CODE>3000.006</ITEM_CODE>
    <DESCRIPTION>ALLISON 3000 SERIES ON HWY TRANSMISSION E016392</DESCRIPTION>
    <MANUFACTURER>ALLISON</MANUFACTURER>
    <APPLICATION>On Highway</APPLICATION>
    <ITEM_COST>8879.02</ITEM_COST>
    <MATERIAL_COST>631.09</MATERIAL_COST>
    <CURRENCY_CODE>AUD</CURRENCY_CODE>
    <PO_UNIT_PRICE></PO_UNIT_PRICE>
    <TRANSACTION_RECEIPT_DATE>25-Jun-09</TRANSACTION_RECEIPT_DATE>
    <PO_NUMBER>982121</PO_NUMBER>
    </G_ASW_REC_DATE>
    </LIST_G_ASW_REC_DATE>
    <CF_SORT_BY>Manufacture,Receipt Date,Organization,Item Code</CF_SORT_BY>
    <CF_SERIAL_WHERE></CF_SERIAL_WHERE>
    </RECDTREP>

    HI Mahesh,
    <TRANSACTION_RECEIPT_DATE>07-Apr-09</TRANSACTION_RECEIPT_DATE>
    this is not a date,
    so you should change the query to get you the format in xsd format : YYYY-MM-DDThh:mm:ss+HH:MM
    otherwise, you have to write a custom sort function to decode and order it it.
    if you dont do the custom order and use
    <?sort:TRANSACTION_RECEIPT_DATE;'ascending';data-type='date'?>
    the data will be treated as string and you will see the row is sorted on string.

  • How to group data based on date

    In my program the internal table is returning several values based on date.
    for example for the first pernr in the image below  there are four records. i need to delete the first record which is between the dates 20 and 30 .
    and also i need to get the difference between the dates as the record 23 and 28  i need to get separate dates as 24, 25..28.

    I am not sure if I understood your question correctly.
    From what I have understood, you can use the following logic.
    This logic will move all the records from lt_fields2 to another table lt_fields1 with begda between 20 and 30 of any month, except for the first record. It will also move records for every date between begda and endda of each record.
    You can alter the logic based on your exact requirement.
    declare another table lt_fields1 like lt_fields2.
    data del_flag.
    data prev_month(2) type c.
    sort lt_fields by pernr begda.
    clear del_flag.
    loop at lt_fields2 into wa_fields where begda+6(2) GE 20.
    * Delete the first record having date greater than 20 in a month for each pernr.
       at new pernr.
            clear del_flag.
       endat.
       if begda+4(2) NE prev_month.
           clear del_flag.
      endif.         
        if del_flag is initial. 
            del_flag = 'X'.
            continue.  " This record will not be moved to the final internal table.
       endif.
    * Add records for each date between begda and endda.
       append wa_fields to lt_fields1.
       prev_month = begda+4(2)
       while wa_fields-begda LT wa_fields-endda.
             wa_fields-begda = wa_fields-begda+1.
             append wa_fields to lt_fields1.
       endwhile.
    endloop.

  • Restrict Query Data based on Date range and Users

    Hi All,
    I have a few web reports that I need do restrict data based on Users.
    In all the queries i have an infoobject 0CALDAY, and  a User Entry range variable on it. Because of performance issues  I need to restrict the range of dates a User can see. Typically most of users could go to a max date range of 1 month back. But some others would need the ability to see data for much bigger range of dates.
    Pls suggest how should i go about with this. Should I have to enforce this at Variable level(user exit).... but then i might have to maintain a table for the users.. Is there any other way of doing it.
    thanks
    Raj

    Any thoughts ?

  • Read data based on date in internal tables

    Hi Abapers,
    In my zreport , i am retreving data from vbrk, vbrp into one internal table ( itab1) and retreiving data from customized table i nto internal table itab2.
    itab1 contains following fields.
    matnr - Material code
    erdat - date ( billing date).
    itab2 contains following fields.
    matnr - material code.
    zfromdate - from date
    ztodate  - to date
    zstprs - material price
    loop at itab1 .
    endloop.
    how to read particular record from itab2 ( which consists of material code with price maintaing with  date range )  based on my billing document date i.e erdat 
    ex: material code     fromdate             todate           price
         10000          01.11.2008     20.11.2008     100.
         10000          21.11.2008     30.11.2008     104
    if for example in itab1 , erdat ( billing doc date is 15.11.2008 ) , how to read first record in itab2 which will fall under that date range.
    please give me any suggestions, or provide sample code.
    regards,
    Hari priya

    Hi,
    Please go in this way
    while selecting fileds from table into itab2
    select in this way
    select * from  <tablename> into tabel itab2 where
      matnr = itab1-matnr and
      zfromdate LE erdat and
      ztodate   GE erdat.
    Loop at itab2.
    read table itab1 with key matnr = itab2-matnr.
    take ur fields into internal table
    endloop.

  • How to get previous values based on date filters

    Hi
    i have two fields gldate and startdate
    gldate values are like 1/31/2011,2/28/2011,3/31/2011,4/30/2011,5/31/2011 ...
    startdate values 1/1/2011,2/1/2011,3/1/2011,4/1/2011,5/1/2011 ...
    i need a condition like gldate<startdate
    if startdate is 11/1/2011 then i get all the values before 11/1/2011 values
    im using filter for date filed
    let us filter values is startdate--11/1/2011 and gldate is 11/30/2011 but that cond falls
    how to get this condition
    plz its urgent to me

    Hi
    i have two fields gldate and startdate
    gldate values are like 1/31/2011,2/28/2011,3/31/2011,4/30/2011,5/31/2011 ...
    startdate values 1/1/2011,2/1/2011,3/1/2011,4/1/2011,5/1/2011 ...
    i need a condition like gldate<startdate
    if startdate is 11/1/2011 then i get all the values before 11/1/2011 values
    im using filter for date filed
    let us filter values is startdate--11/1/2011 and gldate is 11/30/2011 but that cond falls
    how to get this condition
    plz its urgent to me

  • Getting correct row based on date

    Hi,
    if i have the following records for an account:
    now i have a date of 4-1-2013 and I want the row where either 4-1-2013 falls withing the BeginDt and EndDt OR if it does not fall within the BeginDt and EndDt, i wann the EndDt = null row.  So i should only get one row back each time, in this case I
    would get the first row back.
    thanks

    Hi,
    You can use BETWEEN statement to find rows where the date is between your date columns and you can use OR to get the second row if it's not inside the interval.
    There are other solutions, I've implemented this one:
    DECLARE @MyTable TABLE (OrgRoleNumTxt VARCHAR(20), BeginDt DATETIME, EndDt DATETIME);
    DECLARE @SearchDate DATETIME;
    INSERT INTO @MyTable
    SELECT '07238', '2013-01-01 00:00:00', '2013-06-30 23:59:59.997'
    UNION
    SELECT '07238', '2015-03-05 00:00:00', NULL
    -- Scenario #1: Returns the first record (between dates)
    SET @SearchDate = '2013-04-01';
    SELECT TOP 1 * FROM @MyTable WHERE (@SearchDate BETWEEN BeginDt AND EndDt) OR EndDt IS NULL ORDER BY BeginDt ASC;
    -- Scenario #2 (same query): Returns the second record (end date is null)
    SET @SearchDate = '2014-01-01';
    SELECT TOP 1 * FROM @MyTable WHERE (@SearchDate BETWEEN BeginDt AND EndDt) OR EndDt IS NULL ORDER BY BeginDt ASC;
    Hope this helps,
    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.
    Pedro Martins
    Portugal
    https://www.linkedin.com/in/rechousa

  • How to get whole month date based on date

    hi
    i have data at cube with calday and calyear/month
    when ever i entre date like 17/03/2009 , i want output not from 17th , i need output whole month of march?
    please let me know

    Hi,
    Here is the solution:
    1. Create 'ZM_END' Customer exit variable on 0Calday.
      Properties: Mandatory
                  Intervel
                  Uncheck ready for Input
                  0calenderday   
    2. Create ZCDAY User entry Variable on 0Calday
      Properties: Mandatory
                      Single 
                      Check ready for Input
                      0calenderday   
    3. In columns create new selection and then drag & drop your Keyfigure and also Drag 0CALDAY and then restrict 0CALDAY with Variable - ZM_END
    If user will enter 17/03/2009, then the result is from 01/03/2009 to 31/03/2009. I think this is what you are expecting.
    DATA: ZT_SDT TYPE SY-DATUM,
                       SDT TYPE SY-DATUM,
                       ZT_DT1 TYPE SY-DATUM,
                       ZT_DY(2) TYPE N,
                       ZT_MT(2) TYPE N,
                       ZT_YR(4) TYPE N,
    WHEN 'ZM_END'.
      LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
        IF sy-subrc = 0.
          CLEAR: l_s_range.
          ZT_SDT = loc_var_range-low.
          ZT_DY = '01'.
          ZT_MT = ZT_SDT+4(2).
          ZT_YR = ZT_SDT+0(4).
          CONCATENATE ZT_YR ZT_MT ZT_DY INTO ZT_DT1.
          CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
            EXPORTING
              DAY_IN                  = ZT_SDT
           IMPORTING
             LAST_DAY_OF_MONTH       = SDT
           EXCEPTIONS
             DAY_IN_NOT_VALID        = 1
             OTHERS                  = 2
          IF SY-SUBRC <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          l_s_range-low = ZT_DT1.
          l_s_range-high = SDT.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
        ENDIF.
      ENDLOOP.
    Thanks
    Reddy
    Edited by: Surendra Reddy on Mar 18, 2009 3:33 AM

  • Sql query to fetch data based on date conditons

    Hi All,
    We have to schedule a script that runs at 1:00 AM from Monday to Friday.
    The script will run a  sql query  ,that will fetch the data from sql database 2008 based on the below conditions.
    Case 1: If date = current Date then retrieve the data of the previous Date.
    Case 2: If date = Monday then retrieve the entries of Friday ,Saturday and Sunday.
    Please help us on how we can achieve this.
    Thanks

    Hi,
    Are you asking about Patrick's
    solution?
    If so I highly recommend NOT to use this solution. PLease read LMU92's
    and
    Visakh16's responses.
    Why not to use it?
    1. This solution is not deterministic!
    A deterministic algorithm is an algorithm which, given a particular input, will always produce the same output. This solution give different values for different setting! It is depending for example on "SET LANGUAGE" value
    As mentioned above if you try to use any other languge then English then this query will not work since you will never get the value "Sunday"
    2. Moreover! Even if you are using "SET LANGUAGE 'English'" then this
    solution depend on "SET DATEFIRST" and only take into consideration that the value can be 1 or 7, using any other value you will get that @weekendDateMod is null!
    What can you use?
    let's test some value first to get the solution yourself. We know that we don't care about "SET LANGUAGE" since I will not use any language dependency but we need to examine "SET DATEFIRST". Try to change the value from 1 to 7 and check
    the value of this query
    SET DATEFIRST 1 -- Change this value from 1 to 7!
    DECLARE @Sunday DATE = '2014-08-03' -- This is Sunday
    DECLARE @Munday DATE = '2014-08-04' -- This is Munday
    SELECT DATEPART(DW,@Sunday),DATEPART(DW,@Munday), @@DATEFIRST
    Can you see the behavior ?
    The results are hidden here (select the text and you will see them)
    DATEFIRST___Sunday_______Monday
    1___________7___________1
    2___________6___________7
    3___________5___________6
    4___________4___________5
    5___________3___________4
    6___________2___________3
    7___________1___________2
    assuming you did the exercise above yourself, then  you can now think now what is the filter that you need...
    You can use a filter on those two parameters together using "where DATEPART... and @@DATEFIRST...) or using one combine check. Can you think how?
    Notice that this value is always 2 on Monday! Regarding our setting
    (DATEPART(DW,@CurrentDate) + @@DATEFIRST) % 7
    Please Don't Go Down Before YOu Understand!
    Now we can go to the solution
    * I really hope that you read all and did the small exercise yourself! You can not become a developer by copy answers, and this is the reason that from the start I only gave you tha way and not the final query!
    DECLARE @CurrentDate DATE = '2007-08-20' -- This is only for testing since you should use the function GETDATE() instead
    DECLARE @MinDateToFilter DATE
    SET @MinDateToFilter = CASE
    WHEN ((DATEPART(DW,@CurrentDate) + @@DATEFIRST) % 7) = 2 THEN DATEADD(DAY,-4,@CurrentDate)
    ELSE DATEADD(DAY,-1,@CurrentDate)
    END
    SELECT *
    FROM sales.salesOrderHeader
    WHERE orderDate > @MinDateToFilter
    I hope this was useful :-)
    [Personal Site] [Blog] [Facebook]

  • Deleting Data based on Date

    Hi, I am just looking for some help in regards to a table of data I have. Currently I have a list of 500k Job Ids and Time Values. I have managed to identify that I have alot of duplicate job ids and I was looking to find out how i can write a query to give me the first job id with the min date.
    An example of the data table is the following:
    Job ID      |      TimeStamp
    123ab      |     18-MAY-13 21:00:06
    123fg      |     18-MAY-13 21:05:32
    123ab      |     19-MAY-13 11:10:05
    If somebody could please advise, would really appreciate it.

    If you just want a TOP-N query to get the first row of each group, you can use a couple of different methods e.g.
    SQL> select deptno, hiredate from emp order by deptno, hiredate;
        DEPTNO HIREDATE
            10 09/06/1981
            10 17/11/1981
            10 23/01/1982
            20 17/12/1980
            20 02/04/1981
            20 03/12/1981
            20 19/04/1987
            20 23/05/1987
            30 20/02/1981
            30 22/02/1981
            30 01/05/1981
            30 08/09/1981
            30 28/09/1981
            30 03/12/1981
    14 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1  select deptno, hiredate
      2  from (select deptno, hiredate, row_number() over (partition by deptno order by hiredate) as rn
      3        from emp
      4       )
      5* where rn = 1
    SQL> /
        DEPTNO HIREDATE
            10 09/06/1981
            20 17/12/1980
            30 20/02/1981
    SQL> ed
    Wrote file afiedt.buf
      1  select deptno, max(hiredate) keep (dense_rank first order by hiredate) as hiredate
      2  from emp
      3* group by deptno
    SQL> /
        DEPTNO HIREDATE
            10 09/06/1981
            20 17/12/1980
            30 20/02/1981
    Now if you want to actually delete duplicate records, that's a different matter.  A search of the forums for "delete duplicate" should give you plenty of examples.

  • Last 6 months of data based on date feild that is an integer data type

    Hi Folks
    I have a date column called 'YYYYMM' that is an Integer data type in YYYYMM format (eg. 201309). I want to return records from the last 6 months. 
    If the column was in a date format I could use something like 
    [YYYYMM] >DATEADD(M, -6, CURRENT_TIMESTAMP)
    Therefore I assume I need to do a CONVERSION of INT into a date format with something like
    CONVERT (DATE, [YYYYMM]
    But I get the message  "Explicit conversion from data type int to date is not allowed"
    Can someone suggested a work around?
    Many thanks Steve

    another way is this
    SELECT *
    FROM Table
    WHERE DATEADD(mm,(dateintfield%100)-1,DATEADD(yy,(dateintfield/100) -1900,0)) >=DATEADD(mm,DATEDIFF(mm,0,GETDATE())-6,0)AND DATEADD(mm,(dateintfield%100)-1,DATEADD(yy,(dateintfield/100) -1900,0)) < DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Inclusion of data based on date

    Hello:
    I need to extract data for patients who have more than 2 visits to the doctor.
    My query is at the end of the post.
    The criteria is to include only patients which a trait_date >= 09/01/2006 and have been seen 2 or more times from that date.
    For example, Patient A has a date of 12/01/2007 and Patient B has a date of 9/01/2007, 12/12/2007, and 03/01/2008. The query needs to exclude Patient A because they only had one visit whereas Patient B had three visits and it is Patient B that should show up in the data.
    I can't seem to figure out how to write the statement that would let me accomplish this.
    Can someone help me?
    Thank you in advance. Here is the code.
    select a.dwkey_patient, a.date_of_birth, TRUNC(months_between(sysdate, a.date_of_birth)/12) AGE,
          b.dwkey_traittype, b.trait_date, b.trait_value
    from dd.patient_dim a, search.document_traits b
    where a.dwkey_org = b.dwkey_org
    and a.dwkey_patient=b.dwkey_patient
    and a.dwkey_org=45
    and b.dwkey_traittype IN (36883,36885,36884) and b.dwkey_traittype <> 36391
    and b.trait_date >= '01-SEP-06'
    and (b.trait_value <= '35' or b.trait_value = 'Y')
    and TRUNC(months_between(sysdate, a.date_of_birth)/12) >= 18
    order by age asc, a.dwkey_patient asc, b.trait_date asc;Edited by: nyc2292 on Nov 7, 2008 12:03 PM

    WITH PATIENTS AS (SELECT 1 ID, 'Patient 1' NAME FROM DUAL
                      UNION ALL
                      SELECT 2 ID, 'Patient 2' NAME FROM DUAL
         VISITS   AS (SELECT 1 PATIENT_ID, TO_DATE('01.01.2008', 'DD.MM.YYYY') VISIT_DATE,'Illness' REASON  FROM DUAL
                      UNION ALL
                      SELECT 1 PATIENT_ID, TO_DATE('01.01.2007', 'DD.MM.YYYY') VISIT_DATE, 'Pregnant' REASON FROM DUAL
                      UNION ALL
                      SELECT 2 PATIENT_ID, TO_DATE('01.01.2007', 'DD.MM.YYYY') VISIT_DATE,'Hungry' REASON  FROM DUAL
                      UNION ALL
                      SELECT 2 PATIENT_ID, TO_DATE('01.01.2006', 'DD.MM.YYYY') VISIT_DATE, 'Thirsty' REASON FROM DUAL
    SELECT ID,
           NAME,
           REASON
      FROM (
      SELECT ID,
             NAME,
             REASON,
             COUNT(*) OVER (PARTITION BY PATIENT_ID) VISITS
        FROM PATIENTS,
             VISITS
       WHERE ID=PATIENT_ID
         AND VISIT_DATE>TO_DATE('01.09.2006', 'DD.MM.YYYY')
    WHERE VISITS>1

Maybe you are looking for

  • Help in setTimeout function

    I want to pass the argument in the function called in setTimeout function. Below is the code snippet. public function histogramDataPointClick(dataPointObj:Event):void var duration:Number = 5000; setTimeout(executeEvent(dataPointObj),duration); public

  • Problems with the Password File Authentication

    Hi, I try to implement the Password File Authentication in my PC (Window XP). I did : a) orapwd file:=C:\oracle\ora92\dbs\orapw.pwd password=sys2003 entries=5 b) I set the REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE c) I created a user "willer" (With SYST

  • Attribute 'Unicode checks active'

    Hi, we just made an upgrade from 4.6 to ECC 6.0. The unicode conversion check and the unicode conversion itself is done. Each Abap program that has the attribute 'Unicode checks active' not checked ( off ), is causing a syntax error in the new system

  • WRT54GL

    Hi! Im having trouble setting up my 2 WAP54G together with my old Zyxel router. And my WAP54Gs will only communicate with another Linksys devices, right? So i thought id try buying a new router of the same make as the APs to get rid of possible compa

  • SOS: The Scenario of how to backup and recover RAC database

    Hello, I am using the RAC system, but backup and recovery of the RAC system, still are implemented so far. Who know how to use RMAN to realize the backup function for the RAC system? Please help me, thanks a lot first.