Help in query - Group by

Hi,
Kindly view the query.
select loan_id,status_date from loan_status_history group by loan_id,status_date
How to select the records with latest(max) status_date in each group?
regards
Mathew

you use aggregation function on one of the selected column and group by others.
in your example,
select load_id, max(status_date) from loan_status_history group by load_id

Similar Messages

  • Request help with query group by

    Hi,
    I have the following table structure with values
    CREATE TABLE DUMMY
        SR_NUMBER          VARCHAR2(100 CHAR),
        ASSIGNMENT_GROUP   VARCHAR2(100 CHAR),
        REASSIGNMENT_COUNT VARCHAR2(100 CHAR),
        CREATED DATE,
        CLOSED DATE,
        TARGET_DATE DATE
    insert into dummy values('AAA','A','1','02-OCT-11','25-OCT-11','09-OCT-11');
    insert into dummy values('ABC','A','1','03-SEP-12','26-SEP-11','10-SEP-11');
    insert into dummy values('AVB','A','1','02-NOV-13','25-NOV-13','09-NOV-13');
    insert into dummy values('AFT','B','1','02-OCT-11','25-OCT-11','09-OCT-11');
    insert into dummy values('ACS','B','1','02-JAN-12','25-JAN-12','09-JAN-12');
    insert into dummy values('AVC','B','1','02-OCT-13','25-OCT-13','09-OCT-13');
    insert into dummy values('AAD','B','1','02-MAR-14','25-MAR-14','09-MAR-14');
    insert into dummy values('AAA','C','1','02-OCT-11','25-OCT-11','09-OCT-11');
    insert into dummy values('AAA','D','1','02-JUN-11','25-JUN-11','09-JUN-11');
    insert into dummy values('AAA','E','1','02-APR-12','25-APR-12','09-APR-12');
    insert into dummy values('AAA','A','1','02-FEB-13','25-FEB-13','09-FEB-13');
    ?I have the following requirement, the output should be:
    Ticket count (sr_number)
    % of tickets inside DL
    Number of tickets inside DL
    Average cycle time (cycle time = closed date - created date)
    Total cycle time (cycle time = closed date - created date)
    Number of reassignments (sum)
    DL - (deadline) formula is, closed date <= target_date
    This should be displayed, grouped by year, then month and then by assignment group. The values should be in descending order(dates) Not sure how group by will work here.
    I am able to write the basic code for the above, but group by based on year, month and assignment group is pretty confusing to me.
    Can someone provide me a good code...

    This may not give you exactly what you want, but hopefully, it will give you something to work with:
    WITH tickets AS (
      SELECT TO_CHAR(created, 'YYYY') created_year,
             TO_CHAR(created, 'MM') created_month,
             assignment_group,
             COUNT(sr_number) ticket_count,
             AVG(closed - created) avg_cycle_time,
             SUM(closed - created) tot_cycle_time,
             COUNT(reassignment_count) reassign_count
       FROM dummy
       GROUP BY TO_CHAR(created, 'YYYY'),
                TO_CHAR(created, 'MM'),
                assignment_group
    dl_tickets AS (
      SELECT TO_CHAR(created, 'YYYY') created_year,
             TO_CHAR(created, 'MM') created_month,
             assignment_group,
             COUNT(sr_number) ticket_in_dl_count
        FROM dummy
        WHERE closed <= target_date
        GROUP BY TO_CHAR(created, 'YYYY'),
              TO_CHAR(created, 'MM'),
              assignment_group
    SELECT t.created_year,
           t.created_month,
           t.assignment_group,
           t.ticket_count,
           NVL(dl.ticket_in_dl_count, 0) ticket_in_dl_count,
           NVL(dl.ticket_in_dl_count/t.ticket_count, 0) * 100 pct_ticket_in_dl_count,
           t.avg_cycle_time,
           t.tot_cycle_time,
           t.reassign_count
      FROM tickets t,
           dl_tickets dl
      WHERE t.created_year = dl.created_year (+)
      AND t.created_month = dl.created_month (+)
      ORDER BY created_year DESC, created_month DESCEdited by: user1983440 on May 27, 2013 3:47 PM - Added reassign_count
    Edited by: user1983440 on May 27, 2013 3:54 PM - Added ORDER BY

  • Help me query tunning

    Hi Guru's
    Can you please help me query tunning.
    Database Version : Oracle 11g - 11.2.0.3
    select  distinct  corporation_name custer_name,
            glog_util.remove_domain(SHIP_BUY.SERVPROV_GID ) SCAC,
            glog_util.remove_domain(ship_buy.shipment_gid) buy_shipment_gid,
            F_Get_SELL_ID_STRING(SHIP_BUY.SHIPMENT_GID) sell_shipment_gid,
            ship_buy.domain_name,    
            F_GET_ORDER_RELEASE_GID('B',SHIP_BUY.SHIPMENT_GID,0) ORDER_RELEASE_GID,
            f_get_refnum_string('SHIPMENT', ship_buy.shipment_gid, 'MBOL_NUMBER_CLEANSED')MBOL_NUMBER,
            F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID) POD_RECEIVED_DATE,
            f_get_exp_accrue_amt(ship_buy.shipment_gid,'SHIPMENT') Total_accrual_amount    
    from shipment ship_buy,
            invoice inv,
            invoice_shipment si,
            --voucher v,
            corporation corp
    where corp.domain_name=ship_buy.domain_name
            and corp.is_domain_master='Y'
          and 1=1
          AND ship_buy.domain_name like 'UPS/CP/DFP/%'
          and F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID)  <= to_char(to_date('31-JUL-2013', 'DD-MON-YYYY'), 'dd-mon-yyyy')
            --and V.INVOICE_GID(+) = inv.invoice_gid
            --and ship_buy.domain_name = 'UPS/CP/VZNB'
            and si.shipment_gid(+) = SHIP_BUY.SHIPMENT_GID
            AND SI.INVOICE_GID = INV.INVOICE_GID(+)
            and SHIP_BUY.INSERT_DATE > '1-JAN-2007'
            and SHIP_BUY.USER_DEFINED1_ICON_GID = 'ACCEPTED'
    UNION        
    select  distinct  corporation_name custer_name,
            glog_util.remove_domain(SHIP_BUY.SERVPROV_GID ) SCAC,
            glog_util.remove_domain(ship_buy.shipment_gid) buy_shipment_gid,
            F_GET_SELL_ID_STRING( SHIP_BUY.SHIPMENT_GID) sell_shipment_gid,
            ship_buy.domain_name,    
            F_GET_ORDER_RELEASE_GID('B',SHIP_BUY.SHIPMENT_GID,0) ORDER_RELEASE_GID,
            f_get_refnum_string('SHIPMENT', ship_buy.shipment_gid, 'MBOL_NUMBER_CLEANSED')MBOL_NUMBER,
            F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID) POD_RECEIVED_DATE,
            f_get_exp_accrue_amt(inv.invoice_gid,'INVOICE') Total_accrual_amount  
    from shipment ship_buy,
            invoice inv,
            invoice_shipment si,
          -- voucher v,
            corporation corp
    where corp.domain_name=ship_buy.domain_name
            and corp.is_domain_master='Y'
            and 1=1
            AND ship_buy.domain_name like 'UPS/CP/DFP/%'
            and F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID)  <= to_char(to_date('31-JUL-2013', 'DD-MON-YYYY'), 'dd-mon-yyyy')
          --AND INV.DOMAIN_NAME = 'UPS/CP/VZNB'
          --and V.INVOICE_GID(+) = inv.invoice_gid
            and si.shipment_gid(+) = SHIP_BUY.SHIPMENT_GID
            AND SI.INVOICE_GID = INV.INVOICE_GID(+)
            and SHIP_BUY.INSERT_DATE > '1-JAN-2007'
            and INV.USER_DEFINED1_ICON_GID = 'ACCEPTED'
    GROUP BY corporation_name,SHIP_BUY.SHIPMENT_GID,SHIP_BUY.SERVPROV_GID,ship_buy.domain_name,inv.invoice_gid
    ORDER BY CUSTER_NAME, BUY_SHIPMENT_GID;
    And I generated the execution plan :
    | Id  | Operation                          | Name                    | Rows  | Bytes | Cost (%CPU)| Time    |
    |  0 | SELECT STATEMENT                  |                        |    3 |  448 |  415  (2)| 00:00:05 |
    |  1 |  SORT UNIQUE                      |                        |    3 |  448 |  414  (87)| 00:00:05 |
    |  2 |  UNION-ALL                        |                        |      |      |            |          |
    |  3 |    NESTED LOOPS OUTER              |                        |    3 |  384 |    57  (0)| 00:00:01 |
    |*  4 |    HASH JOIN                      |                        |    3 |  294 |    54  (0)| 00:00:01 |
    |*  5 |      TABLE ACCESS BY INDEX ROWID  | SHIPMENT                |    3 |  195 |    40  (0)| 00:00:01 |
    |*  6 |      INDEX SKIP SCAN              | IND_SHIP_DOM_ICON      |    54 |      |    25  (0)| 00:00:01 |
    |*  7 |      TABLE ACCESS FULL            | CORPORATION            |    4 |  132 |    14  (0)| 00:00:01 |
    |*  8 |    INDEX RANGE SCAN              | IND_INVOICESHIP_SHP_GID |    1 |    30 |    1  (0)| 00:00:01 |
    |  9 |    HASH GROUP BY                  |                        |    1 |  192 |  356  (1)| 00:00:05 |
    |* 10 |    HASH JOIN                      |                        |    1 |  192 |  354  (1)| 00:00:05 |
    |  11 |      NESTED LOOPS                  |                        |      |      |            |          |
    |  12 |      NESTED LOOPS                |                        |    1 |  159 |  339  (0)| 00:00:05 |
    |  13 |        NESTED LOOPS                |                        |  145 | 13920 |  194  (0)| 00:00:03 |
    |  14 |        TABLE ACCESS BY INDEX ROWID| INVOICE                |  145 |  5220 |    49  (0)| 00:00:01 |
    |* 15 |          INDEX SKIP SCAN          | IDX_INV_TYP_ICON_NAM    |  145 |      |    17  (0)| 00:00:01 |
    |* 16 |        INDEX RANGE SCAN          | UK_INVOICE_SHIPMENT    |    1 |    60 |    1  (0)| 00:00:01 |
    |* 17 |        INDEX UNIQUE SCAN          | PK_SHIPMENT            |    1 |      |    1  (0)| 00:00:01 |
    |* 18 |      TABLE ACCESS BY INDEX ROWID  | SHIPMENT                |    1 |    63 |    1  (0)| 00:00:01 |
    |* 19 |      TABLE ACCESS FULL            | CORPORATION            |    4 |  132 |    14  (0)| 00:00:01 |
    Predicate Information (identified by operation id):
      4 - access("CORP"."DOMAIN_NAME"="SHIP_BUY"."DOMAIN_NAME")
      5 - filter("F_GET_POD_RECEIVED_DATE"("SHIP_BUY"."SHIPMENT_GID")<=TO_DATE(' 2013-07-31 00:00:00',
                  'syyyy-mm-dd hh24:mi:ss') AND "SHIP_BUY"."INSERT_DATE">TO_DATE(' 2007-01-01 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'))
      6 - access("SHIP_BUY"."USER_DEFINED1_ICON_GID"='ACCEPTED' AND "SHIP_BUY"."DOMAIN_NAME" LIKE
                  'UPS/CP/DFP/%')
          filter("SHIP_BUY"."DOMAIN_NAME" LIKE 'UPS/CP/DFP/%' AND
                  "SHIP_BUY"."USER_DEFINED1_ICON_GID"='ACCEPTED')
      7 - filter("CORP"."IS_DOMAIN_MASTER"='Y' AND "CORP"."DOMAIN_NAME" LIKE 'UPS/CP/DFP/%')
      8 - access("SI"."SHIPMENT_GID"(+)="SHIP_BUY"."SHIPMENT_GID")
      10 - access("CORP"."DOMAIN_NAME"="SHIP_BUY"."DOMAIN_NAME")
      15 - access("INV"."USER_DEFINED1_ICON_GID"='ACCEPTED')
          filter("INV"."USER_DEFINED1_ICON_GID"='ACCEPTED')
      16 - access("SI"."INVOICE_GID"="INV"."INVOICE_GID")
      17 - access("SI"."SHIPMENT_GID"="SHIP_BUY"."SHIPMENT_GID")
          filter("F_GET_POD_RECEIVED_DATE"("SHIP_BUY"."SHIPMENT_GID")<=TO_DATE(' 2013-07-31 00:00:00',
                  'syyyy-mm-dd hh24:mi:ss'))
      18 - filter("SHIP_BUY"."DOMAIN_NAME" LIKE 'UPS/CP/DFP/%' AND "SHIP_BUY"."INSERT_DATE">TO_DATE('
                  2007-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      19 - filter("CORP"."IS_DOMAIN_MASTER"='Y' AND "CORP"."DOMAIN_NAME" LIKE 'UPS/CP/DFP/%')
    Statistics
        246247  recursive calls
              2  db block gets
        1660067  consistent gets
          13839  physical reads
              0  redo size
        592054  bytes sent via SQL*Net to client
          6024  bytes received via SQL*Net from client
            502  SQL*Net roundtrips to/from client
          15296  sorts (memory)
              0  sorts (disk)
          7513  rows processed

    Hmmm...why does this look familiar?
    F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID)  <= to_char(to_date('31-JUL-2013', 'DD-MON-YYYY'), 'dd-mon-yyyy')
    SHIP_BUY.INSERT_DATE > '1-JAN-2007'
    Like I said in your other thread about this, these two lines need to be fixed and your function needs to be fixed so the return statement doesn't do an implicit date conversion.
    Can't you see what that first line is doing?  You're taking a character string, turning it into a date, then back to a character string.
    If nothing else, these lines should be...
    F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID)  <= to_date('31-JUL-2013', 'DD-MON-YYYY')
    SHIP_BUY.INSERT_DATE > to_date('01-JAN-2007','DD-MON-YYYY')
    (assuming insert_date is a proper date format, fingers crossed)

  • Configure custom query group in navigation menu

    How do we configure custom query groups? Say for example: I have created a custom query group and added my custom query definitions to it. How do I configure this so that when I click on Contract Management Tab on the workbench, my custom query group is invoked?
    I need to configure custom query group in navigation menu. Any help would be appreciated.
    Regards,
    Bindu Sharma

    Hi Bindu,
    As per my understanding, it is standard and query group cannot be added in the navigation but you can add your quries under Agreement and Claus Library.
    Kindly refer the blog for the same: http://scn.sap.com/docs/DOC-55733
    Let me know if you need any other information.
    Thanks,
    Kushagra A

  • Easiest way to know the query group name?

    Hello All,
    This has been nagging at me for quite some time now. Would appreciate you inputs on the ways to find out the query group name for a set of queries we see on the UI.
    The obvious method is to search your query group from the list of query groups that system shows when we navigate to Setup->Queries and Reports->Query Groups. Do we have some other ways as well.
    Thanks In Advance
    Devesh

    Hi Devesh,
    If you know the query definition then the easiest way to find the query group would be to use "Search Query Groups by Queries Used" query on the Query Groups list page. This query allows you to select a query definition and returns the query group using the query.
    Or you could use "Query Group Review" query on the Query Groups list page. This returns all queries within all Query Groups. You can further refine your search by Query Name or Internal Name of the query you are interested in.
    If you want to do a general search for all buy-side list page or buy-side picker page query groups, search for <buylist> and <buypick> respectively.
    Hope this helps.
    Regards,
    Vikram

  • Need Help to query Lync Database for User Information

    Need Help to Query the lync database to retrieve below user information.
    1. SIP Address of the registered user
            2. Phone Number configured to the particular account.
            3. IP Address
           4. Last Logged in time.
    I am trying to pull the above information from rtc database for all the registered users. Please let me know if this is possible and it would be great if you can throw some light on what tables to look for the data. Thank You.

    Hi,
    For SIP address and Phone number you can check RTC database.
    IP Address:
    You can refer to the link below to query IP address: 
    http://h30499.www3.hp.com/t5/Business-Service-Management-BAC/Monitoring-Lync-with-the-User-Registrations-Viewer-Free-NMC-tool/ba-p/5961497#.UtOU43mIrwo
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
    Last Logged in time:
    You can refer to the link below:
    http://blogs.technet.com/b/dodeitte/archive/2011/05/11/how-to-get-the-last-time-a-user-registered-with-a-front-end.aspx
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • Multi-query group above report creates more pages

    Hi,
    I have a multi-query group above report (paper only), the parent group creates 5 rows(subframes) all onto the same page, but then creates 4 more IDENTICAL pages!!?
    at the end I have 5 repating frames and 5 pages.
    If I set Maximum Records per Page to 1, I have 5 pages (IDENTICAL) with the first frame only...
    any idea?
    cheers
    Matteo

    hello,
    you will have to create a counter, that tells you the numbers of students (summary-column, function : count, reset on : course) and create a format-trigger on the heading that hides it when the number of students is 0.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Query Group in Query Category different with Authorization's group number

    Hi All,
    In Authorization screen, it allowed to authorize up to 20 query group
    Whereas in Query Category window, it has only max 15 query group.
    Anyone has idea on why is the difference?
    Thanks in advance,
    MH

    You have a very good point.  I believe something must be for system to use during development.  You may post a development request to see if the next version could have matched numbers of query groups.  The forum is on this link:
    /community [original link is broken]
    Thanks,
    Gordon
    Edited by: Paulo Calado on Jun 19, 2009 3:33 PM

  • Query Group and Authorization group is different

    Hi,
    In Authorization screen, it allowed to authorize up to 20 query group. Whereas in Query Category window, it has only max 15 query group. For future patch, is it possible to have matched query groups?
    Thanks.
    Regards,
    MH

    Hi,
    In Authorization screen, it allowed to authorize up to 20 query group. Whereas in Query Category window, it has only max 15 query group. For future patch, is it possible to have matched query groups?
    Thanks.
    Regards,
    MH

  • Linking Query group to an SAP role

    I am able to link the Query group to the role but when we test the user does not have access to it. I know this used to be a problems years ago that I thought was fixes. Any ideas on how to get this to work?

    Hi,
    Assign the required user groups to the user in Sq03. if user still getting same error even after assignments in Sq03, ask user to please change query areas as below and check.
    Sq01 --> Environment --> Query areas --> select "Stanard area (client-specific).
    Regards,
    Gowrinadh

  • Saved query groups authorization

    Dear All,
    Saved query groups - no.1 to no. 20 are available in the authorizations form.
    I see there are only 15 groups  in the query manager --> manage categories, and in the authorizations are 20. the remnants are 5. Where will the five groups to be used and be able to find ?
    I use SBO 2004A. I also see that it is happened in SBO 2005A. I have tried to find in SAP notes but I can't see.
    I appreciate your answers. TIA
    Rgds,

    Hi Steve,
    Seems that noone here on SDN knows the answer (including myself)
    I suggest that you raise that to SAP Support - to have them checking the case.
    Sorry,
    Frank

  • Search help for purchase group in redistribute workload

    HI:
         I want to redistribute SC to other purchase group, when I logon on the SRM with language ZH, the search help for pur group does not work, but if I logon on with EN,everything is fine.
         could anyone tell me why?
    Message was edited by:
            hong pan

    Hi Arun,
    I didn't find Purchase order field in selection-screen of MB51. Please check from your end and let us know exact problem.
    Regards,
    Shravan Kumar N

  • Help with query to return results from group within table?

    Hi
    Im a total noob, so please be gentle....!
    I am looking at a table that has a WORD column and a WORD_TYPE_ID column.
    Words can have the same type_id.
    What I am trying to do is write a query that will return the longest word for each word_type_id.
    I have been trying for hours to get this and all I seem to get is either error messages or I return the longest word in the whole WORD column.
    The furthest I can get before things break down is.....
    select word
    from table
    where
    length(word) =
    select
    max(length(word))
    from table
    Any help on this or if I could be pointed in the right direction it would be greatly appreciated.
    Thanks

    Hi,
    Welcome to the forum!
    Here's one way:
    SELECT    word_type_id
    ,       MIN (word) KEEP (DENSE_RANK LAST ORDDER BY LENGTH (word))     AS longest_word
    FROM       table_x
    GROUP BY  word_type_id;If there happens to be a tie within some word_type_id (that is, 2 or more words have exactly the same length, which is the longest in that group) the expression above will return the first one, in alphabetic order. (That's what MIN means here.)
    Edited by: Frank Kulash on Aug 11, 2009 1:56 PM
    You almost had it.
    As you noticed, you were getting the longest row in the whole table. That's because your sub-query was looking at the whole table.
    If you correlate the sub-query to the row in the main table, as shown below, you can get the longest word in each group:
    select  word
    from     table     m                              -- m for main
    where      length (word) = (
                                select  max (length(word))
                   from     table
                   where     word_type_id  = m.word_type_id     -- New
                   );

  • Help with a group query

    I have the following table
    EX_ID
    EX_NAME
    EX_SURNAME
    EX_FLAG
    1
    TOM
    JONES
    Y
    1
    JIM
    SLIM
    N
    1
    BO
    SELECTA
    Y
    2
    AIRES
    BEARS
    N
    2
    JIM
    DAVIES
    Y
    3
    PAUL
    BALL
    N
    3
    YOU
    KNOW
    N
    I need to create a query that only displays one of the ex_id’s, it doesn’t matter which one.  When the query has been run it will look like below:
    EX_ID
    EX_NAME
    EX_SURNAME
    EX_FLAG
    1
    TOM
    JONES
    Y
    2
    AIRES
    BEARS
    N
    3
    YOU
    KNOW
    N
    Can anyone help with this query?

    SELECT * FROM
    SELECT *,ROW_NUMBER () OVER (PARTITION BY ex_id ORDER BY (SELECT 0))
    FROM tbl
    ) AS Der WHERE rn=1
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Select Query (Grouping) - Help

    Hi,
    Here is the table (sample)
    Table: AmountCode
    Code Amount1 Amount2 Amount3 Amount4
    ABC 11 23 234 124
    ABC      23      567      567      556
    XYZ      56      234      235      344
    XYZ      55      56      789      7855
    AAA      567      12      234      4367
    AAA      789      98      6577      4368
    BBB                     
    I want to sum different Columns in the above table based on the Code Field (grouping). How to write this query?
    If Code = ABC
    Sum(Amount1) as OutAmount
    Sum(Amount2) as InAmount
    If Code = XYZ
    Sum(Amount3) as OutAmount
    Sum(Amount4) as InAmount
    If Code = AAA
    Sum(Amount1) as OutAmount
    Sum(Amount3) as InAmount
    If Code = BBB
    I want to get OutAmount & InAmount from different Table.
    Thanks in advance

    try like this..
    for Code = BBB, i wrote general summation...
    accordingly you can modify this query...
    with rt as
    (select 'ABC' Code, 11 Amount1, 23 Amount2, 234 Amount3, 124 Amount4 from dual union all
    select 'ABC', 23, 567, 567, 556  from dual union all
    select 'XYZ', 56, 234, 235, 344  from dual union all
    select 'XYZ', 55, 56, 789,7855 from dual union all
    select 'AAA', 567, 12, 234, 4367 from dual union all
    select 'AAA', 789, 98, 6577, 4368 from dual union all
    select 'BBB', null,null,null,null from dual)
    select code,
            decode(code,'ABC',Sum(Amount1),'XYZ',Sum(Amount3),'AAA',Sum(Amount1),'BBB',(select sum(sal) from test_emp where deptno = 10),0) OutAmount,
            decode(code,'ABC',Sum(Amount2),'XYZ',Sum(Amount4),'AAA',Sum(Amount3),'BBB',(select sum(sal) from test_emp where deptno = 20),0) InAmount
    from rt group by code order by code;
    COD  OUTAMOUNT   INAMOUNT
    AAA       1356       6811
    ABC         34        590
    BBB      12786      13237
    XYZ       1024       8199 [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • User-authorized only values in matchcode

    Hi people, I get a strange behaviour of the BEx variable Input matchcode. I implemented 2 Multiproviders, containing a common authorization on an characteristic. The authorization variable is "ready to Input". In the first multiprovider, when I launc

  • One Portal user has several user in other systems - how to handle SSO

    Hi, I read a lot through several threads but could not really find the information that I need: Problem: Each PERSON has ONLY ONE unique portal user to log in. In SAP SRM / EBp these persons sometimes must have multiple users. Normally they login in

  • Why can't continue play awb format file after call...

    Need a help! When I use most of S40 phone to playing awb format file,if playing be interrupt, music player can't continue to play from where it stopped.Is that normal? Or this relate awb format? Proconditon: Had connect headset (phone support) Step:

  • MTN numbers in usage stats - how to determine where they originate

    Evening all, I could not find an appropriate category for this question.  So I am hoping here is ok. In MyVerizon, under usage statistics > voice calls I see occasional MTN numbers show up. I was told these are Mobil Telephone Numbers, however the nu

  • Asynchronous webservice

    Hello I have read that in Java EE 6 we can declare a webservice method as asynchronous using @Asynchronous annotation using EJB 3.1 How do we make asynchronous webservices using EJB 3.0 Thanks Vidyadhar