To get the amount based on the code

hi all,
i am using db10g.
i have a query like below
SELECT SUM(EID_AMOUNT),EID_INCR_CODE,EIH_EFF_DATE
FROM EMPLOYEE_INC_HEADER,EMPLOYEE_INC_DETAILS
WHERE EIH_EMP_CODE = EID_EMP_CODE
AND EIH_EFF_DATE = EID_EFF_DATE
AND EIH_EMP_CODE = '0026108'
GROUP BY EID_INCR_CODE,EIH_EFF_DATE
ORDER BY EID_INCR_CODE,EIH_EFF_DATEcurrently i am getting result set like this
SUM(EID_AMOUNT) EID_INCR_CODE   EIH_EFF_D
            500 BASIC           01-JAN-09
            750 BASIC           01-MAY-09
            300 HTRAN           01-JAN-09
            500 HTRAN           01-MAY-09
            200 OTHERS          01-JAN-09
            350 OTHERS          01-MAY-09but i want to get the out put like
SUM(EID_AMOUNT) EID_INCR_CODE   EIH_EFF_D
           1250 BASIC           01-JAN-09
            800 HTRAN           01-JAN-09
            550 OTHERS          01-JAN-09in otherwords i want get sum of amount for that incr_code and effective date will be the minimum date amoung which the data is fetched(in the example out of six resulted record '01-jan-09' is the least data).
is there is any way where i can acheive the above?
Please help..
Thanks..

Maybe
select the_sum,
       EID_INCR_CODE,
       EIH_EFF_DATE
  from (SELECT SUM(EID_AMOUNT) over (partition by EID_INCR_CODE order by EIH_EFF_DATE) the_sum,
               EID_INCR_CODE,
               EIH_EFF_DATE,
               row_number() over (partition by EID_INCR_CODE order by EIH_EFF_DATE) rn
          FROM EMPLOYEE_INC_HEADER,
               EMPLOYEE_INC_DETAILS
         WHERE EIH_EMP_CODE = EID_EMP_CODE
           AND EIH_EFF_DATE = EID_EFF_DATE
           AND EIH_EMP_CODE = '0026108'
where rn = 1
ORDER BY EID_INCR_CODE,EIH_EFF_DATEor
SELECT SUM(EID_AMOUNT) KEEP (DENSE_RANK FIRST ORDER BY EIH_EFF_DATE) the_sum,
       EID_INCR_CODE,
       EIH_EFF_DATE
  FROM EMPLOYEE_INC_HEADER,
       EMPLOYEE_INC_DETAILS
WHERE EIH_EMP_CODE = EID_EMP_CODE
   AND EIH_EFF_DATE = EID_EFF_DATE
   AND EIH_EMP_CODE = '0026108'
GROUP BY EID_INCR_CODE,EIH_EFF_DATE
ORDER BY EID_INCR_CODE,EIH_EFF_DATERegards
Etbin
Edited by: Etbin on 13.11.2011 13:41
aggregate solution added

Similar Messages

  • Query to get the Excise amount and basic amount based on the cst or vat tax

    Dear all,
                       I need a right query to get the basic amount ,excise amount and the tax amount based on the CST or VAT tax rate.The output should be like this,
    VAT
    goods excisabe at 1% - taxable amt(basic+excise for vat 1%)            tax amt
    goods excisable at 4%-   txable amt                                                       tax amt
    CST
    goods excisabe at 1% - taxable amt(basic+excise for CST 1%)            tax amt
    My problem will also be solved..if i am able to get  the basic value from base table OPCH itself............Since am using the PCH1 table to get the total basic amt...the values are duplicating.
    Regards,
    Shyam

    Hi Sowjanya,
    If you're simply trying to place a grand total, use the 'Insert Summary' option.
    Choose the measure field as the 'Field to Summarize' > Choose 'Sum' as the summary operation > Under 'Summary Location' choose 'Grand Total Report Footer'.
    -Abhilash

  • Get value from the array based on the HashCode

    public static void runJoin(int[][] t1,int[][] t2)
         PrintWriter out=null;
         int rows = 1000;
         int cols = 7;
         int [][] myTable3 = new int[rows][cols];
         int x = 0;
         System.out.print("Running HashJoin:Method loads the "+
         "smaller table in the memory and applies a hashing function "+
         "to common column and stores it in another table. "+
         "The larger table is then read from the file. "+
         "The same hashing function is applied to Col n of the table and a       matching record in the first table is looked up. A match will create a row in Table 3. ");          
    //Apply hashing function to smaller table and store it in the memory.
              Integer[] It2 = new Integer[t2.length];
              int [] hashCodest2 = new int[t2.length];
              Hashtable ht = new Hashtable();
              for(int i =0; i <t2.length;i++){
                   It2[i] = new Integer(t2[0]);
                   hashCodest2[i] = It2[i].hashCode();
                   ht.put(new Integer(hashCodest2[i]),It2[i]);
              //Larger table get hashcodes
              Integer It1[] = new Integer[t2.length];
              int [] hashCodest1 = new int[t2.length];          
              for(int j =0; j <t1.length;j++){
                   It1[j] = new Integer(t1[j][4]);
                   hashCodest1[j] = It1[j].hashCode();               }
              //Based on the hashcode get the value from the Table2;
              try{
    out = new PrintWriter( new FileOutputStream( "c:\\HashJoinTable.txt" ) );
              Enumeration e = ht.keys();
                   while(e.hasMoreElements())
    //How do I get the value from the array based on the HashCode? Do I need to do a loop here???                         
    hashCodes1.get(e.nextElement());           
              }catch(Exception e){}

    ok I got it......
              //Apply hashing function to smaller table and store it in the memory.
              Integer[] It2 = new Integer[t2.length];
              int [] hashCodest2 = new int[t2.length];
              Hashtable ht = new Hashtable();
              for(int i =0; i <t2.length;i++){
                   It2[i] = new Integer(t2[0]);
                   hashCodest2[i] = It2[i].hashCode();
                   ht.put(new Integer(hashCodest2[i]),It2[i]);
              //Larger table get hashcodes and compare
              Integer It1[] = new Integer[t2.length];
              int [] hashCodest1 = new int[t2.length];          
              Hashtable ht2 = new Hashtable();
              for(int j =0; j <t1.length;j++){
                   It1[j] = new Integer(t1[j][4]);
                   hashCodest1[j] = It1[j].hashCode();               
                   ht2.put(new Integer(hashCodest1[j]),It1[j]);
              //Based on the hashcode get the value from the Table2;
              try{
    out = new PrintWriter( new FileOutputStream( "c:\\HashJoinTable.txt" ) );
              Enumeration e = ht.keys();
              Integer t3[] = new Integer[t2.length];
                   while(e.hasMoreElements())
                        t3[x] = (Integer) ht2.get(e.nextElement());                
                        x++;
              }catch(Exception e){}

  • Need to calculate the monthly amount based to the annaul salary

    Hi Expert,
    I need to calculate the monthly amount based to the annual salary.
    Some countries use a multiplier more than 12 to calculate the annual salary (e.g : 13,14 ...).
    My problem is to calculate the monthly increase.
    The increase amount is on the annual salary but for the monthly increase, normally, the system divides by the mutliplier.
    But some countries would like calculate these amount on 12 and not the real multiplier.
    So, could you please tell me there are user-exits or other to make this ???
    Thanks in advance,
    Virginie

    Hi Virginie,
    Check both feature PFREQ (Edit with transaction PE03) and user-exit corresponding to enhancement PARA0001.
    rgds,
    Carlos.

  • I've to extract the data based on the sysdate...like today dd is 11,

    BM_PERF is the table name and
    BM_PERF_YR,BM_PERF_MONTH,BM_NOP_CT_1........BM_NOP_CT_31 are the column names.
    I've to extract the data based on the sysdate...like today dd is 11
    so i've to get data from BM_NOP_CT_11 and the column names changes dynamically based on the sysdate. don't use any procedures and functions.

    You could always pivot it into a more convenient form for querying:
    WITH t1 AS
         ( SELECT 2008 AS yr, 4 AS mnth
                , 20 AS dy1
                , 10 AS dy2
                , 15 AS dy3
                , 1  AS dy4
                , 17 AS dy5
                , 99 AS dy6
                , 55 AS dy7
                , 45 AS dy8
                , 33 AS dy9
                , 22 AS dy10
                , 74 AS dy11
                , 35 AS dy12
                , 62 AS dy13
                , 24 AS dy14
                , 85 AS dy15
           FROM dual )
       , t2 AS
         ( SELECT yr
                , mnth
                , sys.DBMS_DEBUG_VC2COLL
                  (dy1,dy2,dy3,dy4,dy5,dy6,dy7,dy8,dy9,dy10,dy11,dy12,dy13,dy14,dy15)
                  AS day_data
           FROM   t1 )
    SELECT t2.yr, t2.mnth, sys_op_ceg(t2.day_data,5) day_value
    FROM   t2;
            YR       MNTH DAY_VALUE
          2008          4 17
    1 row selected.Note that SYS_OP_CEG (first discovered by Padders) is undocumented and unsupported - for production code you'd need to pick the collection row using a WHERE clause, and for that you'd need a custom object and collection type with an attribute to hold the day number.
    Message was edited by:
    William Robertson
    ...like this:
    CREATE TYPE id_value_ot AS OBJECT
    ( id INTEGER, val NUMBER );
    CREATE TYPE id_value_tt AS TABLE OF id_value_ot ;
    WITH t1 AS
         ( SELECT 2008 AS yr, 4 AS mnth
                , 20 AS dy1
                , 10 AS dy2
                , 15 AS dy3
                , 1  AS dy4
                , 17 AS dy5
                , 99 AS dy6
                , 55 AS dy7
                , 45 AS dy8
                , 33 AS dy9
                , 22 AS dy10
                , 74 AS dy11
                , 35 AS dy12
                , 62 AS dy13
                , 24 AS dy14
                , 85 AS dy15
           FROM dual )
       , t2 AS
         ( SELECT yr
                , mnth
                , id_value_tt
                  ( id_value_ot(1,dy1)
                  , id_value_ot(2,dy2)
                  , id_value_ot(3,dy3)
                  , id_value_ot(4,dy4)
                  , id_value_ot(5,dy5)
                  , id_value_ot(6,dy6)
                  , id_value_ot(7,dy7)
                  , id_value_ot(8,dy8)
                  , id_value_ot(9,dy9)
                  , id_value_ot(10,dy10)
                  , id_value_ot(11,dy11)
                  , id_value_ot(12,dy12)
                  , id_value_ot(13,dy13)
                  , id_value_ot(14,dy14)
                  , id_value_ot(15,dy15) )
                  AS day_data
           FROM   t1 )
    SELECT yr, mnth, dd.val
    FROM   t2, TABLE(t2.day_data) dd
    WHERE  dd.id = 5;
            YR       MNTH        VAL
          2008          4         17
    1 row selected.

  • FM to get open period based on company code

    Could you pls tell me the FM which can get open period based on the company code?
    right answer will be rewared for sure.
    Sujatha

    Hi,
    I m not sure. Just check this out.
    CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
        EXPORTING
          companycodeid = p_bukrs
          posting_date  = p_bedat
        IMPORTING
          fiscal_year   = gd_fiscalyr
          fiscal_period = gd_fiscalp.
    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.
    check this link.
    http://www.sapdevelopment.co.uk/fmodules/fmssap.htm
    Regards
    Vadi
    Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 5:41 PM

  • Filter the report based on the date

    Hi Experts,
    i am working with alv report, I need filter the records based on the field.
    So i tried like this.
    data : t_filter TYPE slis_t_filter_alv,
           w_filter TYPE slis_filter_alv.
    W_FILTER-FIELDNAME = 'WERKS'.
    W_FILTER-SIGN0 = 'I'.
    W_FILTER-OPTIO = 'BT'.
    W_FILTER-VALUF_INT = '1003'.
    W_FILTER-VALUT_INT = '1007'.
    APPEND W_FILTER TO t_FILTER.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_INTERFACE_CHECK                 = ' '
        I_BYPASSING_BUFFER                = ' '
        I_BUFFER_ACTIVE                   = ' '
        I_CALLBACK_PROGRAM                = ' '
        I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = ' '
        I_CALLBACK_TOP_OF_PAGE            = ' '
        I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
        I_CALLBACK_HTML_END_OF_LIST       = ' '
        I_STRUCTURE_NAME                  =
        I_BACKGROUND_ID                   = ' '
        I_GRID_TITLE                      =
        I_GRID_SETTINGS                   =
        IS_LAYOUT                         =
         IT_FIELDCAT                        = IT_FIELDCAT
        IT_EXCLUDING                      =
        IT_SPECIAL_GROUPS                 =
        IT_SORT                           =
         IT_FILTER                          = t_filter
        IS_SEL_HIDE                       =
        I_DEFAULT                         = 'X'
         I_SAVE                            = 'A'
        IS_VARIANT                        =
        IT_EVENTS                         =
    But it is was not get the output,
    Pls help me how to write the code to filter the recodes.
    if any one post the code.
    Please help me.
    Thanks Advance
        IT_EV

    check the documentation of the fm
    Table with filter criteria
    Using this parameter, you can pass on filter criteria resulting from explicitly loading a display variant in advance, for example, to list output.
    This table should never be set up 'manually'.
    check these programs
    BCALV_TEST_FULLSCREEN_FILTER
    BCALV_TEST_LIST
    Thanks
    Bala Duvvuri
    Edited by: Bala Duvvuri on Oct 24, 2010 10:41 PM

  • How to implement Check box in the Rtf based on the value from XML datafield

    Hello All ,
    It would be great if any one can help me in implementing check box in the rtf based on the data filed value from the XML data.
    I need to get in the out put checked boxes like what we say Radio button Yes or No ( If Yes it should be marked ).
    If any one worked on this please help us...
    Thanks in Advance...

    Did you check the user guide,
    we have a section over there :)
    http://blogs.oracle.com/xmlpublisher/2007/05/22

  • You want to know the amount of space the transaction log for the Customer database is using. Which T-SQL command would you use?

    You want to know the amount of space the transaction log for the Customer database is using. Which T-SQL command would you use?

    Forced me to do a little research.
    DBCC SQLPERF(logspace)
    See also
    http://stackoverflow.com/questions/198343/how-can-i-get-the-size-of-the-transaction-log-in-sql-2005-programmatically
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Why does the Amount slider on the Detail Panel reset to 0 when saving the file as a Smart Object?

    Whenever I open a Smart Object PSD file to adjust previous settings in RAW, I have noticed that the Amount slider in the Detail panel has reset to 0. Does this reduce the files sharpening? Is this a normal behavior? Can this be prevented?
    I use a Mac running 10.6.8 and Photoshop CS6, version 13.0.5 x 64.

    This behavior happens only on Mac desktop computer, not on my Mac laptop running the same CS6.
    After I've edited an ACR file (including sharpening in the Detail panel), I change the file into a PSD Smart Object to complete my edit by clicking on "Open Object". I immediately notice this PSD file is not sharp. If I click on the bottom right of the image icon to return to the RAW file, I find the Amount slider in the Detail Panel has changed from the sharpening amount I gave it, to 0.
    If I do the exact same thing on my laptop (running a duplicate of the same Photoshop CS6), this behaviour does not happen. The image remains sharp as a PSD file, and if I check by returning to ACR, the Amount slider has maintained its setting.
    Anything more you need?

  • How to control the measure based on the related dimension.

    Hi Experts,
    In order to improve performance, I have created three kinds of time tables in DB,such as Year .Month, Day.
    Then import them into the physical layer in RPD, and combine them into one dimension in BMM.
    Actually, it has three level fact related with three time tables,so they are also dragged into one fact in BMM,and one column will be corresponding with three column derived from different Fact table in physical layer.
    So I want to know how to control the measure based on the related dimension.
    For example:
    when users drag the Year,Sales column, it will come from Year Dimension and Year Fact Table.
    when users drag the Month,Sales column, it will come from Month Dimension and Month Fact Table.
    when users drag the Day,Sales column, it will come from Day Dimension and Day Fact Table.

    Hi,
    Create a dimension Hierarchy, with Year >> Month >> Day Levels and
    Next Double click on Year Table LTS >> click on Ocntetnt Tab >> set as Year
    same way for Month LTS and Day LTS.
    So now when you select year column then server canknow which LTS to hit and Hits Year LTS.
    Mark If Helpfu/correct
    Thanks.

  • I bought a team license for two computers, the purchase was recorded on the credit card and the amount recorded in the making, but was unable to validate the association staff . I received an email stating that Adobe could not release the payment and that

    I bought a team license for two computers, the purchase was recorded on the credit card and the amount recorded in the making, but was unable to validate the association staff .
    I received an email stating that Adobe could not release the payment and that I should validate the method of payment , tried to insert another card number but the system does not accept the security VAT reporting error message. How do I validate my license with association staff and confirm the payment card?

    Hi Daniel,
    For any sort of payment related matter, kindly contact our support team via:  http://helpx.adobe.com/in/contact.html?step=CCSN_adobe-id-signing-in_stillNeedHelp
    If you are unable to use chat option kindly try below mentioned steps.
    Try different browser.
    Delete cookies and cache
    If you are still not able to chat, Kindly reply with the below mentioned information.
    OS version:
    Browser Version:
    You can also try: http://helpx.adobe.com/x-productkb/global/phone-support-orders.html 
    Thanks,
    Atul Saini

  • How to Handle and show multiple pushpin imgaes on the map based on the requirement at different coordintes?

    How to Handle and show multiple pushpin imgaes on the map based on the requirement at different coordintes?
    I have multiple images in  my App folder. I want to use and show those images dynamically  in windows phone 8 map application

    There are a lot of different ways to do this. One simple method is to use a switch statement when creating your pushpins and based on some property in your data, select the icon you want to use and create your pushpin accordingly.
    http://rbrundritt.wordpress.com

  • Is it possible to find the  table based on the Date ?

    Dear Team ,
    Is it possible to find the table based on the Date ?
    I have created an table ,But forgot the Table Name .
    Is it possible to find the Tables created on particular Date .
    Regards ,
    Augustine

    as date is record the time also below query will work.
    select * from user_objects
    where
    object_type = 'TABLE' and
    to_date(created,'DD-MON-YYYY') =to_date('<your date value in DD-MON-YYYY format>','DD-MON-YYYY');
    Edited by: shaileshM on Feb 24, 2010 9:39 PM

  • How to calculate the amount of viewing the uploaded document in KM?

    hello
         everyone
          I  want to  calculate the amount of viewing the uploaded document in KM,like the iviews of topics in forum.
         thanks in advance
         lexian

    Hi,
       You can develop a hitcount repository services. Each time that you open a document this counter is incremented in one. Then you can show this metadata as a typical property.
    Take into account:
    Dynamic Knowledge Management Content Using Groovy Scripts
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5165
    Documents read statistics
    https://www.sdn.sap.com/irj/sdn/thread?threadID=174925
    Patricio.

Maybe you are looking for

  • How do I upload photographs from browser in Windows 7?

    I don't see the option to upload photographs in my adobe revel window in my browser.  Could you help please?  I am using a windows 7 PC with Internet Explorer 9

  • Edit Form in Acrobat Pro 9.4.2

    I have a form I created in an earlier version of Acrobat about 12 months ago. I've now been called upon to edit this same form and, surprise surprise, I can no longer edit it. There are no security settings in place in the file. Where before I had th

  • Export and Import of mappings/process flows etc

    Hi, We have a single repository with multiple projects for DEV/UAT and PROD of the same logical project. This is a nightmare for controlling releases to PROD and in fact we have a corrupt repository as a result I suspect. I plan to split the reposito

  • FP11 beta 2 (64bit linux) freezes complete system

    Help guys, my system freezes a few seconds after having started any flash video (e.g. youtube) with FP 11 beta 2. I can only recover it with kernel SysRq keys. The only evidence from the log files I have found: NVRM: Xid (0000:01:00): 8, Channel 0000

  • How do create query in SAP?

    Dear Expert How do create query report in SAP? thanks for advance