Refresh the result table or rerun the query

I have a requirement, simple but stuck somewhere.

Jdev 11.1.1.17 Expert level: Mid-Senior

I have a form of application and the associated result table. It works great and no problems.

My requirement is that I have a commandlink on one of the column. Clicking on that will open a popup with an editable filed. OK will commit and Cancel will close the pop-up window.

After that the popup is dismissed with partial trigger, my table refreshes but data is identical to the front. But if I click the Find (Search) button on the query, it shows the data with the results updated which are changed in the pop-up window above.

How do I update table which re - runs the query and then refreshes the table after the popup is dismissed, or when the user clicks the OK button in the pop-up window.

Get on the viewObject of this table and call the executeQuery method that

Write this method in the method AMImpl and then call it in bean managed using the OperationBinding at the click on the Ok button of the dialog box

ViewObject vo = this.getViewObjectName ();

vo.executeQuery ();

Ashish

Tags: Java

Similar Questions

  • Refresh the query area

    Hello team APEX,

    I want to refresh the query of a region, it is a region of report, could I do? How?

    Never I click on an icon in my interactive report, calling a javascript function which shows the region, but in the application, I have a where clause with a page item clause.

    Thank you very much!

    Hi Raul,

    the blog posting also briefly covers the traditional reports.

    For conventional reports, it's a bit more complicated as described above, because there is no attribute "Elements of Page to submit" (again!).
    If you need to save values in session in a slightly different way State. I'll try to add that too when I can. (Tip: instead)
    the definition of IRR "Elements of Page to submit" as stated in the last point, use the 'Code of PL/SQL Execute' action within the dynamic action,
    fire before action "refresh." Just leave the code as 'null '; and set the "Elements of Page to submit" attribute for the elements on your page.
    It will work, but unfortunately issues 2 Ajax calls to do, which isn't optimal.)

    ->
    (1) create a dynamic action of type 'run PL/SQL '.
    (2) code: NULL;
    (3) referred to submit page: put your Page element, you want to be updated on the server so that the query retrieves
    (4) after the action create action "Refresh" for the region of classic report

    Concerning
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Results of the query variant with unused table in the from clause

    Hi all

    I (processing_table2) table specified in the FROM clause in the SQL query , but I have not used any of its value in the SQL statement , but it still affects the results of the query. Please help me out here I'm naïve.

    This is the provided query

    SELECT SUM((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    cssp sales_split,
    processing_table2
    WHERE crev.order_num = '7631090072'

    Results of the above query : 344028065018.359



    SELECT

    Sum((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    sales_split PCSS

    WHERE crev.order_num = '7631090072'

    Results of the above query : 26463697309.1046


    Someone here suggest me pls!

    924804 wrote:
    Hi all

    I (processing_table2) table specified in the FROM clause in the SQL query , but I have not used any of its value in the SQL statement , but it still affects the results of the query. Please help me out here I'm naïve.

    This is the provided query

    SELECT SUM((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    cssp sales_split,
    processing_table2
    WHERE crev.order_num = '7631090072'

    Results of the above query : 344028065018.359

    SELECT

    Sum((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    sales_split PCSS

    WHERE crev.order_num = '7631090072'

    Results of the above query : 26463697309.1046

    Someone here suggest me pls!

    CARTESIAN PRODUCT of the changes result set

  • Select a table returned in the result of the query

    Hi, I'm trying to find a way to query a table name that I'm back to a different query. I am doing this in pure SQL and PL/SQL, if I can.

    Here's the situation. I have a table called FILES, a table called TYPE and an unknown number of different reference tables with different names.

    Each entry in the FILE has a reference to a TYPE id, and each entry type is a varchar that contains the name of a table reference, such as PHOTO_INFORMATION, PDF_INFORMATION or XML_INFORMATION.

    I want to be able to extract the data from the reference table for any data file. So with a file id, I question TYPE to get the name of the reference table (IE, "PHOTO_INFORMATION" back) then the request it is at this table for all of its columns, using the reference id in the FILE table.

    The thing is that I wish it were generic, so that I can just add an entry to AA_TYPE and a new table for this type, and then I can ask her but I want, through the FILE table. The reason is that there are some data that is common for all files, and I would like to that data in one place.

    Here is my paintings, I have two reference tables of the sample to the bottom "AA_FILETYPE1" and "AA_FILETYPE_PHOTO".
    CREATE TABLE  "AA_FILES" 
       (     "FILE_ID" NUMBER, 
         "FILE_NAME" VARCHAR2(4000), 
         "FILE_TYPE" NUMBER, 
         "REFERENCE_ID" NUMBER, 
          CONSTRAINT "AA_TEST_FILE_PK" PRIMARY KEY ("FILE_ID") ENABLE
       )
    /
    
    CREATE TABLE  "AA_TYPE" 
       (     "TYPE_ID" NUMBER NOT NULL ENABLE, 
         "REFERENCE_TABLE" VARCHAR2(4000), 
          CONSTRAINT "AA_TYPE_PK" PRIMARY KEY ("TYPE_ID") ENABLE
       )
    /
    
    CREATE TABLE  "AA_FILETYPE1" 
       (     "REFERENCE_ID" NUMBER, 
         "DATE_MODIFIED" DATE, 
         "SUMMARY" VARCHAR2(4000), 
         "TOTAL_VALUE" NUMBER(5,2), 
          CONSTRAINT "AA_FILETYPE1_PK" PRIMARY KEY ("REFERENCE_ID") ENABLE
       )
    /
    
    CREATE TABLE  "AA_FILETYPE_PHOTO" 
       (     "REFERENCE_ID" NUMBER NOT NULL ENABLE, 
         "DATE_TAKEN" DATE, 
         "CAMERA_NUMBER" VARCHAR2(4000), 
         "WEATHER_CONDITIONS" VARCHAR2(4000), 
         "CONSULTANT_NAME" VARCHAR2(4000), 
          CONSTRAINT "AA_FILETYPE_PHOTO_PK" PRIMARY KEY ("REFERENCE_ID") ENABLE
       )
    /
    Here's an example query I would use:
    select * from (select REFERENCE_TABLE from AA_TYPE where TYPE_ID = AA_FILES.FILE_TYPE) where REFERENCE_ID = AA_FILES.REFERENCE_ID;
    So who withdrew all the columns in the reference given in AA_TYPE table based on an entry in AA_FILES.

    I'm not entirely sure how to do this, or if this is possible even without using PL/SQL.

    I'm open to suggestions on how to achieve what I want with a different design of table, I am a student and I'm not really experienced in database design. (My first design of database class isn't until next year!)

    Thank you very much!

    Hello

    [email protected] wrote:
    Sorry about the confusion about file_id = 3, I meant the insert in the third I've included. I did not indicate the id_fichier in my inserts since it is the main key and it auto increments.

    It is important to post of the CREATE TABLE and INSERT statements that work. All those who want to help you to will want to recreate the problem and test solutions. Also, do not use strings for all entries. If the column is a NUMBER, use a NUMBER in the INSERT statement. If the column is a DATE, use a DATE or a function that returns a DATE.
    So you should post something like:

    insert into AA_FILES(FILE_ID, FILE_NAME, FILE_TYPE, REFERENCE_ID) values (1, 'test-photo-1.jpg',  1,  1);
    insert into AA_FILES(FILE_ID, FILE_NAME, FILE_TYPE, REFERENCE_ID) values (2, 'test-xml-1.jpg',    2,  2);
    insert into AA_FILES(FILE_ID, FILE_NAME, FILE_TYPE, REFERENCE_ID) values (3, 'test-photo-2.jpg',  1,  2);
    -- The value file_type=1 immediately above was not in your original data, but seems to be what you meant.
    
    prompt =====  AA_TYPE Table:  =====
    
    insert into AA_TYPE(TYPE_ID, REFERENCE_TABLE) values (1, 'AA_FILETYPE_PHOTO');
    insert into AA_TYPE(TYPE_ID, REFERENCE_TABLE) values (2, 'AA_FILETYPE1');
    
    prompt =====  AA_FILETYPE1 Table:  =====
    
    insert into AA_FILETYPE1 (REFERENCE_ID, DATE_MODIFIED,                 SUMMARY,                                    TOTAL_VALUE)
           values           (1,           TO_DATE ('01-01-02', 'MM-DD-RR'), 'An XML file that has some information about something', '14');
    
    prompt =====  AA_FILETYPE_PHOTO Table:  =====
    
    insert into AA_FILETYPE_PHOTO (REFERENCE_ID, DATE_TAKEN,                 CAMERA_NUMBER, WEATHER_CONDITIONS, CONSULTANT_NAME)
                    values            (1,          TO_DATE ('01-01-01', 'MM-DD/RR'), 'abc123',      'rainy!',         'John Smith');
    insert into AA_FILETYPE_PHOTO (REFERENCE_ID, DATE_TAKEN,                 CAMERA_NUMBER, WEATHER_CONDITIONS, CONSULTANT_NAME)
                    values            (2,          TO_DATE ('01-01-02', 'MM-DD/RR'), 'def456',      'slightly cloudy',  'Jane Jones');
    commit;
    

    To give you my workplace, I'm applying in Application Express. A user has entered the number '3' the file_id (I'm not worried about the distinction between passing in the id_fichier and the name of the file, I just my application one application or the other).

    Now, run a query that will get related data which table it is stored in. I don't know the name of the table at design time, as that particular file may be of any type (each of which has a different table name). However, with a the file_id, I have a file_type (in aa_files) which refers to an entry in aa_type.

    I see. You could add even add new tables after this query is written. As long as the new table has a column named reference_id, and there is a line for the new table in aa_files, the following query should work.

    >

    select FILE_TYPE
    from AA_FILES
    where FILE_ID = 3
    

    I stored the name of the table, I need to ask for the rest of the data in aa_type at design time, so using the file_type value, I can get the name of reference_table:

    select REFERENCE_TABLE from AA_TYPE where FILE_TYPE = 1
    

    In the sample data, you have validated, Type_de_fichier = 2 on the 3rd row. I've changed that in my example 1 revised data.
    Be very careful that your explanation fits your data. You talk to people who know about your application, and it is very easy for them to be induced in error or confusion.

    Now the '1' is here that the first query would return. I would like to use a subquery to combine these two queries into a single (I think?). This second query would return "AA_FILETYPE_PHOTO", which is the reference table.

    So I have the reference table, which is a name of table to another table in my database. It contains the data that I'm actually looking for. I want it for this particular file (file_id 3), and in aa_files, I have a value of "reference_id", which refers to the respective line in the reference table. File_id 3, the reference_id is 2.

    select * from AA_FILETYPE_PHOTO
    where reference_id = 2
    

    If the above query gets me my final data.

    Now, I've been watching substitution values and bind variables, here's another way to explain what I want:

    Explanation step by step below is very useful. It would be more useful if each step uniquely and gavce movement results given the sample data and an example of setting (3 in this case)

    -- get the file_type from aa_files for the desired file
    EXEC :file_type := (select file_type from aa_files where file_id = 3);
    

    That we will call the step step (a) above.
    Step (a) sets: Type_de_fichier 1 (given my corrected sample data)

    -- get the reference table from aa_types using the file_type
    EXEC :reference_table := (select reference_table from aa_type where type_id = :file_type);
    

    That we will call the step step (b) above.
    (B) sets the stage: reference_table to 'AA_FILETYPE_PHOTO '.

    -- get the reference_id from aa_files for the desired file
    EXEC :reference_id := (select reference_id from aa_files where file_id = 3);
    

    That we will call the step step (c) above.
    (C) sets the stage: reference_id 2

    -- using the reference table and reference id for the desired file, get the rest of the data
    select * from :reference_table where reference_id = :reference_id;
    

    Not sure if this makes it more clear or not.

    Yes, it helps a lot.

    Basically I have a table full of table names. How do I write a query that pulls one of these table names and it then queries?

    You need SQL dynamic, because you can't hardcode a table name in the query that you normally would be.
    How dynamic SQL works normally (and the functioning of this example) are that the query is built by using a variable. In SQL * more (as shown below), you can simply use a variable substitution instead an identifier hardcoded, and that's what it takes to make the dynamic query from SQL * more resolves the substitution variables before sending the code for the compiler. I don't know much on the Apex, but I bet there's some way to do dynamic SQL in the Apex, too.
    So the dynamic part here should include step d, since you can't hardcode the name of the table in the query.
    Until we can step (d), then, did they to us to do the steps (a) and (b) to obtain this file name. In the example blelow, I used a separate, preliminary request to get the & table_name...
    Step (c) could be made in the main query, using a subquery or a join. However, I chose to step (c) in the preliminary motion, as well as steps (a) and (b), since it's the same table same step (a). In this way, step (d) must refer to a table.

    Here's (finally) how to make this work in SQL * more:

    ACCEPT     file_id     PROMPT     "Enter the file_id (a number, e.g. 3): "
    
    -- Preliminary Query, to set table_name
    
    COLUMN     reference_id_col     NEW_VALUE     reference_id
    COLUMN     table_name_col           NEW_VALUE     table_name
    
    SELECT  f.reference_id          AS reference_id_col
    ,     t.reference_table       AS table_name_col
    FROM      aa_files     f
    JOIN     aa_type          t     ON     f.file_type     = t.type_id
    WHERE     f.file_id     = &file_id
    ;
    
    --     Main Query
    
    SELECT  *
    FROM     &table_name
    WHERE      reference_id     = &reference_id
    ;
    

    The results, account required to the data from the sample I posted above, and the & file_id 3, are:

    `                      CAMERA_    WEATHER_        CONSULTANT_
    REFERENCE_ID DATE_TAKE NUMBER     CONDITIONS      NAME
    ------------ --------- ---------- --------------- ---------------
               2 01-JAN-02 def456     slightly cloudy Jane Jones
    
  • the query results to table 2d

    I have a list created dynamically IDs I want to query a table
    for matching records for one of the IDs. I can run a loop of the list
    the query, but what is the best way to put all of the matching records
    each individual ID into a single statement of output? I question 7
    different columns, so if I use a table it would need to be 2
    dimensional and I do not know how to write the results of the query to a 2d
    table. Or y at - it an easier way for the release of all data without
    put in a picture at all?

    Here is the corresponding code so far:

    Change your code to the attachment to start (no loops!):

  • Inside af AF:selectOneChoice: table sometimes does not display the appropriate values, based on the results of the query of the view object

    Hello

    I use jdev 12.1.2.

    I have a few components of af: selectOneChoice that is contained in an af:table element.  The table is extracting lines from database and display data.  Now here's the weird part: sometimes the component of selectOneChoice will have the correct value selected, and other times it will be just left unchecked.  I can verify that the data in the object view lines are indeed correct after I request them.  The LOV for soc components are properly set up (some are configured as static list display objects and some are set up as model driven lists based on display objects).  I have just completely puzzled me as to why they work sometimes and then not work at times even though I am following the exact same steps to reach that point in my application.  Someone at - he never meets this problem before?

    Thanks for reading.

    Problem solved!

    For anyone having this problem in the future: do not try to do a partial trigger on a table that is not in the visible panelTab.  The problem is that when my view criteria applying, I was refreshing the TWO tables.  This caused that was not visible to lose the selectOneChoice selection, while the other table was very good.  Remove the partial relaxation for the table that was not visible caused the data to be maintained properly during the exchange between the tabs and change the view criteria.  Thanks for the help again Ashish, stumbled on the real root of the problem, after following some of your suggestions.

  • Effect of an additional table in the FROM clause in the query results?

    I recently helped a colleague debug one of their SQL statements

    The output was showing some very unexpected totals, and I was able to shrink down to an additional table in the FROM clause, but not used anywhere else in the application.

    Thus, for example

    SELECT A.ID, B.CODE
    Of
    EMPLOYEE,
    B OF THE STATUTE,
    PAY THE SAL
    WHERE A.ID = B.ID
    AND
    A.ID = 1;

    I was wondering, how can an extra table in a FROM clause influence directly on the rest of the query?

    The query above is just an example of what I've seen, the my co worker was working on is a bit larger and a lot more code to read. I noticed that when I added/removed the extra table in my query to co workers and then it worked as expected.

    I always thought that an additional table is not attached to what anyone would be just to do the inefficient code, but does not affect output
    just do the inefficient code

    Yes, that too, you will get a Cartesian product by calling is not the entries in the where clause for this table 'disappeared' :(

  • How to refresh the result iterator to uncommitted changes

    Hello

    JDev 11.1.2.4

    I have a VO with a VC. In my AM I exposed 2 VO:

    VO1 = VO without the VC

    VO2 = VO with the VC

    I have in my user interface:

    VO1-based array in which I can add, update, or delete rows.

    a button that shows a popup that contains a table based on VO2

    Scenario: update

    I make a modification on an existing line. The change is made on automatic transmission of true - field.

    I click on the button

    The table on the shortcut menu shows the changed value

    Ok

    Scenario 1: create

    I have create a new line. Fields to create the new line are all send auto = true

    I click on the button

    The table on the shortcut menu does not show the new line. It shows only the last State (original + changed lines lines)

    KO

    Scenario 1: remove

    I delete an existing line.

    I click on the button

    The table on the shortcut menu does not show the deleted row. It shows only the last State (original + changed lines lines)

    KO

    Q: what can I do, for the table on the shortcut menu shows the current status (non-validated data). I tried to refresh the iterator after a creation or deletion, but I still get the old data?

    DCIteratorBinding myIterator = ADFUtils.findIterator (iterator);
    myIterator.executeQuery ();
    myIterator.refresh (DCIteratorBinding.RANGESIZE_UNLIMITED);

    Thank you

    It depends on the vo and the Victoria Cross. The two vo must rest on the same area of occurrence. The Victoria Cross should have mode query so (memory and db) and the Victoria Cross on the second vo should be in a way that the new line would be part of the result set if given th could be read from db.

    Timo

  • Filter the table display of the query object (it can a bug in jdev 12)

    Hello:

    I found an error/bug possible in jdeveloper 12 c when I migrate my application of jdev 11g.

    To test this issue, I did the same test request in jdeveloper 11g and jdeveloper 12 c (to avoid to migrate the process).

    Project template

    -Create a display of the query object. Code:

    SELECT 1 CODE, 100 DESCRIPTION
      FROM DUAL
    UNION ALL
    SELECT 2 CODE, 200 DESCRIPTION
      FROM DUAL
    

    -Create a Module of the Application, and then drag this point of view in.

    ViewController project

    -Create a page and drag in the criteria named 'All searchable attributes' of the previous ViewObject as "ADF table filtered.

    -Run the application

    Results:

    On jdeveloper 11g, however it makes the filter above the table box in jdev not 12 c.

    Is this a bug or I need to select something in jdev12c to get the same functionality?

    Yes, known bug 17279781.  It is currently scheduled for a 12.1.4 fix.  If this issue is crucial to you, please file an SR, mentioning the bug number and indicate your reasons for wanting a fix as soon as possible.

    Note there is a solution:

    To work around the problem, you can configure the filter yourself by adding an af:inputText

    facet filter columns and bind the inputText property value to the EL

    #{vs.filterCriteria. }. The page to rerun the filter for

    the column look and work.

    CM.

  • 2.1 EA1: Query Builder does not update the query to display the results

    When using the query designer, if you click view results to see the results of the current query, then return to "Select columns" or the tabs 'Create a Where Clause' change the query, the "View results" tab shows again the results of the original query, even if no tables or columns of the original query occurs. By clicking on the button run the report or by setting a refresh interval has no effect.

    On another note, the query designer again is not reentrant, because you cannot select (highlight a part where cursor in) a query, and then open the query for this request of change graphically Designer.

    Sentinel,

    The problem is known and is listed in the known issues in the release notes for the first users. We hope to have this sent to production.

    Returning Query Builder is always on our list of things to do. We intend to rewrite the Query Builder and examine a number of requests related to this function. I'm hoping to make it a priority for the next release.

    Sue

  • ORA-06504: PL/SQL: return variables of the game results or the query types do not match

    Hello!

    I have a simple object type and a proecdure in which I am trying to use it to insert into another table

    -object

    CREATE ORREPLACETYPEmt_mtg ASOBJECT

    (

    ACOL NUMBER ,

    BCOL NVARCHAR2 (100)

    );

    CREATE ORREPLACETYPEREF_MTG ASTABLEOFMt_MTG ;

    -same structure as the use of sampletbl target table in the cursor query

    create table tbl_MT_MTG

    (

    ACOL NUMBER ,

    BCOL NVARCHAR2 (100)

    );

    -procedure

    CREATE ORREPLACEINTERIORTEST_PROCEDURE1

    AS

    ref_cur sys_refcursor ;

    REFR ref_mtg ;

    BEGIN

    OPEN ref_cur FOR

    Select acol,

    BCOL

    DE sampletbl rownum<10;

    Fetch ref_cur in bulk collectintorefr;

    Insert intotbl_MT_MTG(acol,bcol)selectacol,bcol fromtable(refr);

    commit;

    CLOSE Ref_cur;

    END;

    /

    When I run this procedure fails with

    ORA-06504: PL/SQL: return variables of the game results or the query types do not match

    ORA-06512: at "TEST_PROCEDURE1", line 10

    ORA-06512: at line 2

    Any help on this please...

    Thanks to an OLD POST below

    so perfect helped me! Thank you

    Tubby

    After 5 years of more :-)

    How to store refcursor in collection How to store refcursor in collection

  • How to exclude the result of the query of account?

    I am stuck how can I update my request.

    Can anyone help please?

    CREATE TABLE "LOGON"."LOGON_DATA" 
       ( "CLIENT" VARCHAR2(20 BYTE) NOT NULL ENABLE,
      "ROW_ID" NUMBER NOT NULL ENABLE, 
      "OUR_ACCOUNT" VARCHAR2(1 BYTE), 
      "DATE_OF_LOGON" VARCHAR2(20 BYTE) NOT NULL ENABLE, 
      "LOGON_ID" NUMBER NOT NULL ENABLE, 
        );
    

    SAMPLE of DATA (for a "client" for a day):

    PETER123,021,N,10-01-2015,121514
    PETER123,022,,10-01-2015,121514
    PETER123,023,N,10-01-2015,221514
    PETER123,024,Y,10-01-2015,221514
    PETER123,025,Y,10-01-2015,221514
    PETER123,026,Y,10-01-2015,221514
    PETER123,027,Y,10-01-2015,221514
    PETER123,028,N,10-01-2015,221514
    PETER123,029,,10-01-2015,221559
    PETER123,030,Y,10-01-2015,221600
    PETER123,189,N,10-01-2015,225601
    PETER123,201,Y,10-01-2015,233539
    

    ...

    10 million lines

    12 c - 12.1.0.1.1 - I used 'insert' in SQL Developer to load Oracle data.

    The query below counts everything after the first 'our_account' = there is found and excludes in double "logon_id" County, but...

    WITH    got_first_row_id    AS
    (
        SELECT  client, logon_id
        ,       row_id
        ,       MIN ( CASE
                          WHEN  our_account  = 'Y'
                          THEN  row_id
                      END
                    ) OVER (PARTITION BY  client)   AS first_row_id
        FROM    LOGON_DATA
        where date_of_logon = '10-01-2015'
    )
    SELECT    client, COUNT(DISTINCT logon_id) AS cnt
    FROM      got_first_row_id
    WHERE     row_id  > first_row_id 
    GROUP BY  client
    order by COUNT(DISTINCT logon_id) desc;
    

    .. .but how can I also exclude "logon_id" number which is + 1 in the previous result?

    i.e.

    If my result will be logon_id = 225500 - I don't want to count the 225501 but I count on 225502

    The query must rely to the extent indicated in pink:

    PETER123, 021, N-10-01-2015, 121514

    PETER123, 022, 10-01-2015, 121514

    PETER123, 023, N-10-01-2015, 221514

    PETER123, 024, Y, 10-01-2015, 221514

    PETER123, 025, Y, 10-01-2015, 221514

    PETER123, 026, Y, 10-01-2015, 221514

    PETER123, 027, Y, 10-01-2015, 221514

    PETER123, 028, N-10-01-2015, 221514

    PETER123, 029, 10-01-2015, 221559

    PETER123, 030, Y, OCTOBER 1 00

    PETER123, 189, N-10-01-2015, 225601

    PETER123, 201, Y, 10-01-2015, 233539

    the expected result would be

    customer, cnt

    PETER123, 4

    Very appreciated for any help.

    Using

    If I understand your problem, the implementation in your case might be like this:

    WITH evaluated_logons AS

    (SELECT

    customer,

    logon_id,

    ROW_ID,

    MIN (DECODE (our_account, 'Y', row_id)) compared to first_row_id (partition by customer).

    LAG (logon_id, 1, -1) on previous_logon_id (partition sales order by logon_id)

    OF logon_data

    WHERE date_of_logon = TO_DATE (1 October 2015 ', 'MM DD YYYY')

    )

    SELECT

    customer,

    Count (*) AS cnt

    Of evaluated_logons

    WHERE

    -do not count Y first

    ROW_ID > first_row_id

    -count only nonsequtive logon_ids

    AND previous_logon_id + 1<>

    Customer GROUP

    NTC to ORDER BY DESC

    ;

  • Unable to produce the query results

    Hi all

    Hello. I'm aunable write a query that can produce reuls froe below question. An account can have several part relationship.

    Here is the data for the x table

    PartyID - AcctNo - indicator - RoleCode

    1111      -----     123   ------     Y         -------  110

    1112    -------     123   ------    N        --------- 120

    1113     ------     123   ------   N          --------   130

    1114     -------   124     -----   N        --------    100

    1115    --------   124    ------- N         ---------   110

    1116   ---------   124      ----   N       ---------    100

    1115      --------  125             Y       -------        100

    1116      -------    125             N      ------         110

    1117      -------   126            Y         -----        100

    Query should return these AcctNo is not any indicator = 'Y' and RoleCode did not have 100. In this case the results should be

    AcctNo

    123

    124

    Thanks in advance

    Don

    Hello

    885137 wrote:

    Hi, Frank, here is creation and insertion of table scripts. ...

    Thank you.

    So what's the problem with the query I posted in response #1?  (You must use the correct name of the table, of course).  Specify where he makes incorrect results and explain why these results are false.

  • Taking a lot of time to get the result of the query

    Hi all

    The query below takes a long time for results

    select vs.task_name, count(*) fallout_count  from provco.view_stage_history vs
     where record_type in ('TASK')
      and task_name like 'Op-%'
      and vs.line_of_business = 'OPTIONLESS'
    --  and vs.task_due_date > ((sysdate - 146)) and vs.task_due_date is not null
    --  and vs.order_due_date > ((sysdate - 146)) and vs.order_due_date is not null
      and vs.fallout_date > ((sysdate - 146)) and vs.fallout_date is not null
    --  and vs.assignment_date > ((sysdate - 146)) and vs.assignment_date is not null
    --  and upper(vs.install_country_code) like 'US%'
      and vs.ban is not null
    --  and vs.task_name not in ('ASR-Assignment', 'SOR-Assignment')
      group by vs.task_name order by fallout_count desc;
    

    Its takes an hour to get the result. You will find the description of the table and the index below

    CREATE TABLE "PROVCO"."VIEW_STAGE_HISTORY" 
       ( "TASK_ID" NUMBER NOT NULL ENABLE, 
      "ASSIGNMENT_DATE" TIMESTAMP (6) NOT NULL ENABLE, 
      "LINE_OF_BUSINESS" VARCHAR2(30 BYTE) NOT NULL ENABLE, 
      "ORDER_ID" NUMBER NOT NULL ENABLE, 
      "ORDER_NUMBER" VARCHAR2(128 BYTE) NOT NULL ENABLE, 
      "ORDER_VERSION" VARCHAR2(15 BYTE) NOT NULL ENABLE, 
      "ORDER_TYPE" VARCHAR2(25 BYTE), 
      "TASK_NAME" VARCHAR2(60 BYTE) NOT NULL ENABLE, 
      "FALLOUT_DATE" TIMESTAMP (6), 
      "JEOP_CODE" VARCHAR2(64 BYTE), 
      "ERROR_CODE" VARCHAR2(64 BYTE), 
      "ERROR_DESC" VARCHAR2(1000 BYTE), 
      "WORKGROUP" VARCHAR2(30 BYTE), 
      "WORKPOOL" VARCHAR2(50 BYTE), 
      "USER_ID" VARCHAR2(32 BYTE), 
      "RECORD_TYPE" VARCHAR2(40 BYTE) NOT NULL ENABLE, 
      "ASSIGNMENT_TYPE" VARCHAR2(40 BYTE), 
      "ORDER_DUE_DATE" TIMESTAMP (6), 
      "COMMIT_DATE" TIMESTAMP (6), 
      "TASK_DUE_DATE" TIMESTAMP (6), 
      "SEED" VARCHAR2(255 BYTE), 
      "BAN" VARCHAR2(100 BYTE), 
      "ORDER_STATUS" VARCHAR2(64 BYTE), 
      "PROJECT_ID" VARCHAR2(20 BYTE), 
      "CUSTOMER_NAME" VARCHAR2(128 BYTE), 
      "CIRCUIT_ID" VARCHAR2(53 BYTE), 
      "SENSITIVITY_LVL" VARCHAR2(10 BYTE), 
      "BANDWIDTH" VARCHAR2(8 BYTE), 
      "WORK_STEP" NUMBER, 
      "MARKETING_APPROVAL_DATE" TIMESTAMP (6), 
      "INSERTED" TIMESTAMP (6), 
      "UPDATED" TIMESTAMP (6), 
      "INSTALL_COUNTRY_CODE" VARCHAR2(3 BYTE), 
      "SOLD_COUNTRY_CODE" VARCHAR2(3 BYTE), 
      "UPSTREAM_ORDER_NUMBER" VARCHAR2(15 BYTE), 
      "SAR_ID" VARCHAR2(15 BYTE), 
      "DUE_DATE_TYPE" VARCHAR2(4 BYTE), 
      "HOTCUT_IND" VARCHAR2(3 BYTE), 
      "MARKET_SEGMENT" VARCHAR2(50 BYTE), 
      "CNTL_TERM" VARCHAR2(25 BYTE), 
      "SVC_ORD_TYPE" VARCHAR2(40 BYTE), 
      "BLENDED_IND" VARCHAR2(1 BYTE), 
      "RELATED_ORDERS" VARCHAR2(100 BYTE), 
      "TERM_ID" VARCHAR2(20 BYTE), 
      "SUB_SVC_ORD_TYPE" VARCHAR2(40 BYTE), 
      "LAST_TASK_NAME" VARCHAR2(40 BYTE), 
      "PRE_OA_STATUS" VARCHAR2(40 BYTE), 
      "TSP_CODE" VARCHAR2(12 BYTE), 
      "ORDER_CATEGORY" NUMBER, 
      "CHANGE_CATEGORY" NUMBER, 
      "COUNTRY_CODE" VARCHAR2(2 BYTE), 
      "RESELLER_ID" VARCHAR2(19 BYTE), 
      "STATUS_CODE" VARCHAR2(32 BYTE), 
      "STATUS_CATEGORY" VARCHAR2(32 BYTE), 
      "PROVISIONING_LOCATION" VARCHAR2(32 BYTE), 
      "INSTALLED_LOCATION" VARCHAR2(32 BYTE), 
      "DATE_ORDERED" TIMESTAMP (6), 
      "CUSTOMER_NAME_ABBR" VARCHAR2(8 BYTE), 
      "CPE_IND" VARCHAR2(1 BYTE), 
      "CUSTOMER_PON" VARCHAR2(20 BYTE), 
      "PRODUCT_ID" VARCHAR2(20 BYTE), 
      "ASR_PON" VARCHAR2(16 BYTE), 
      "ASR_PON_VER" VARCHAR2(3 BYTE), 
      "ASR_TYPE" VARCHAR2(3 BYTE), 
      "ASR_TRAN_TYPE" VARCHAR2(1 BYTE), 
      "PARTNER_CARRIER_ID" VARCHAR2(8 BYTE), 
      "PREMISE_SEQUENCE_NUMBER" VARCHAR2(3 BYTE), 
      "EXPEDITE_IND" VARCHAR2(6 BYTE), 
      "ORDER_SOURCE" VARCHAR2(40 BYTE), 
      "SERVICE_REQ_ID" VARCHAR2(40 BYTE), 
      "SUB_ORDER_VALUE" VARCHAR2(50 BYTE), 
      "SUB_ORDER_TYPE" VARCHAR2(15 BYTE), 
      "PROV_OWNER" VARCHAR2(32 BYTE), 
      "TASC_OWNER" VARCHAR2(32 BYTE), 
      "DM_OWNER" VARCHAR2(32 BYTE), 
      "ORDNBR_TYPE" VARCHAR2(128 BYTE), 
      "WORK_ID" NUMBER, 
      "GARM_TYPE" VARCHAR2(50 BYTE), 
      "USER_TASK_DUE_DATE" TIMESTAMP (6), 
      CONSTRAINT "VIEW_STAGE_HISTORY_PKY" PRIMARY KEY ("TASK_ID", "ASSIGNMENT_DATE")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
      STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "TBS_PROVCO_IDX"  ENABLE, 
      SUPPLEMENTAL LOG GROUP "GGS_211360" ("TASK_ID", "ASSIGNMENT_DATE") ALWAYS
       ) SEGMENT CREATION IMMEDIATE 
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
     NOCOMPRESS LOGGING
      STORAGE(INITIAL 524288 NEXT 524288 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "TBS_PROVCO_DAT" ;
    
    
      CREATE INDEX "PROVCO"."VIEW_STAGE_HISTORY_IDX5" ON "PROVCO"."VIEW_STAGE_HISTORY" ("ORDER_NUMBER", "TASK_NAME") 
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
      STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "TBS_PROVCO_IDX" ;
    
    
      CREATE INDEX "PROVCO"."VSH_INSERTED_IDX" ON "PROVCO"."VIEW_STAGE_HISTORY" ("INSERTED") 
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
      STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "TBS_PROVCO_IDX" ;
    
    
      CREATE INDEX "PROVCO"."VSH_LOB_OT_ON_IDX" ON "PROVCO"."VIEW_STAGE_HISTORY" ("LINE_OF_BUSINESS", "ORDER_TYPE", "ORDER_NUMBER") 
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
      STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "TBS_PROVCO_IDX" ;
    
    
      CREATE INDEX "PROVCO"."VSH_LOB_TN_IDX" ON "PROVCO"."VIEW_STAGE_HISTORY" ("LINE_OF_BUSINESS", "TASK_NAME") 
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
      STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "TBS_PROVCO_IDX" ;
    

    Explain the plan of the query is

    SQL> explain plan for
      2  select vs.task_name, count(*) fallout_count  from provco.view_stage_history vs
     where record_type in ('TASK')
      3    4    and task_name like 'Op-%'
      5    and vs.line_of_business = 'OPTIONLESS'
      6  --  and vs.task_due_date > ((sysdate - 146)) and vs.task_due_date is not null
      7  --  and vs.order_due_date > ((sysdate - 146)) and vs.order_due_date is not null
      8    and vs.fallout_date > ((sysdate - 146)) and vs.fallout_date is not null
      9  --  and vs.assignment_date > ((sysdate - 146)) and vs.assignment_date is not null
     10  --  and upper(vs.install_country_code) like 'US%'
     11    and vs.ban is not null
    --  and vs.task_name not in ('ASR-Assignment', 'SOR-Assignment')
     12   13    group by vs.task_name order by fallout_count desc;
    
    
    Explained.
    
    
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'typical cost bytes'));
    
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 3788003769
    
    
    ------------------------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name               | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |                    |   191 | 10505 |       |   136K  (1)| 00:27:24 |
    |   1 |  SORT ORDER BY                |                    |   191 | 10505 |  1536K|   136K  (1)| 00:27:24 |
    |   2 |   SORT GROUP BY NOSORT        |                    |   191 | 10505 |       |   136K  (1)| 00:27:24 |
    |*  3 |    TABLE ACCESS BY INDEX ROWID| VIEW_STAGE_HISTORY | 21528 |  1156K|       |   136K  (1)| 00:27:21 |
    |*  4 |     INDEX RANGE SCAN          | VSH_LOB_TN_IDX     |   229K|       |       |  1474   (1)| 00:00:18 |
    ------------------------------------------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       3 - filter("VS"."BAN" IS NOT NULL AND "RECORD_TYPE"='TASK' AND "VS"."FALLOUT_DATE">SYSDATE@!-146)
       4 - access("VS"."LINE_OF_BUSINESS"='OPTIONLESS' AND "TASK_NAME" LIKE 'Op-%')
           filter("TASK_NAME" LIKE 'Op-%')
    
    
    18 rows selected.
    

    the view_stage_history table has 19504509

    Please let me know somehow that we can speed up the query above.

    Thank you

    Mani

    How much time does it take if you suggest a full table scan?

  • How to remove the additional summary of the result of the query

    All,

    I create a derived table two tables and then join the result then using function group but the result is to summarize a number of additional time, can correct all my request. Here are the tables and relevant data.

    CREATE TABLE SHP_DW_TEMP_DEL_WEIGHT_TB

    (

    CUSTOMER_ID NUMBER DEFAULT NULL,

    NUMBER OF CARRIER_ID,

    DATE OF BILL_DATE,

    VARCHAR2 (200 BYTE) SERVICE,

    NUMBER OF WEIGHT,

    Create_date DATE default sysdate,

    SHIPPER_ID NUMBER DEFAULT NULL

    )

    CREATE TABLE SHP_DW_TEMP_DEL_SPEND_TB

    (

    CUSTOMER_ID NUMBER DEFAULT null,

    NUMBER OF CARRIER_ID,

    DATE OF BILL_DATE,

    VARCHAR2 (200 BYTE) SERVICE,

    NUMBER OF COST,

    Create_date DATE default sysdate,

    SHIPPER_ID NUMBER DEFAULT of null

    )

    CREATE TABLE SHP_DW_INTERM_TB

    (

    JAVA_SESSION_ID VARCHAR2 (1000 BYTE),

    USER_ID NUMBER,

    CUSTOMER_ID NUMBER DEFAULT NULL,

    CLIENT_NAME VARCHAR2 (100 BYTE),

    NUMBER OF CARRIER_ID,

    CARRIER_NAME VARCHAR2 (100 BYTE),

    NUMBER OF IS_LTL_CARRIER

    SHIPPER_GROUP_ID NUMBER DEFAULT NULL,

    SHIPPER_ID NUMBER DEFAULT NULL,

    SHIPPER_NAME VARCHAR2 (100 BYTE),

    CREATE_DATE DATE DEFAULT SYSDATE,

    FREIGHT_RANK NUMBER DEFAULT of null

    )

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (FEBRUARY 25, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL FEDEX GROUND', 602, TO_DATE (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (11 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL FEDEX GROUND', 243, TO_DATE (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (11 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), ' FIRST INTERNATIONAL AIRPORT THE NIGHT ', 1.8, TO_DATE (MARCH 25, 2014 04:28:29 ',' ' DD/MM/YYYY HH24:MI:SS));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (11 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL ECONOMY' 8203.5, TO_DATE (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (4 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL PRIORITY OVERNIGHT', TO_DATE 2351.1, (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (11 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL PRIORITY OVERNIGHT', TO_DATE 2979.7, (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (FEBRUARY 25, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL ECONOMY' 8622.1, TO_DATE (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (4 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL ECONOMY' 10358.4, TO_DATE (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (18 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL PRIORITY OVERNIGHT', 2899, TO_DATE (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (FEBRUARY 25, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL PRIORITY OVERNIGHT', TO_DATE 2597.1, (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (4 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL FEDEX GROUND', 121, TO_DATE (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (18 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL ECONOMY' 9015.5, TO_DATE (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_WEIGHT_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, WEIGHT, CREATE_DATE)

    Values

    (664, 22, TO_DATE (18 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL FEDEX GROUND', 729, TO_DATE (MARCH 25, 2014 04:28:29 ',' DD/MM/YYYY HH24:MI:SS'));))

    COMMIT;

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (FEBRUARY 25, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL FEDEX GROUND', 356.65, TO_DATE (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (11 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL FEDEX GROUND', 181.19, TO_DATE (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (11 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), ' FIRST INTERNATIONAL AIRPORT THE NIGHT ', 134.45, TO_DATE (MARCH 21, 2014 03:13:16 ',' ' DD/MM/YYYY HH24:MI:SS));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (4 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL PRIORITY OVERNIGHT', TO_DATE 7267.92, (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (11 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL ECONOMY' 27755.2, TO_DATE (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (11 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL PRIORITY OVERNIGHT', TO_DATE 8192.35, (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (FEBRUARY 25, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL ECONOMY' 26388.53, TO_DATE (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (18 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL PRIORITY OVERNIGHT', TO_DATE 8825.98, (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (4 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL ECONOMY' 31653.45, TO_DATE (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (FEBRUARY 25, 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL PRIORITY OVERNIGHT', TO_DATE 7901.07, (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (4 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL FEDEX GROUND', 167.73, TO_DATE (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (18 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL FEDEX GROUND', 959.85, TO_DATE (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    Insert into msidw. SHP_DW_TEMP_DEL_SPEND_TB

    (CUSTOMER_ID, CARRIER_ID, BILL_DATE, SERVICE, COST, CREATE_DATE)

    Values

    (664, 22, TO_DATE (18 FEBRUARY 2014 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'AIRPORT INTERNATIONAL ECONOMY' 28209.22, TO_DATE (MARCH 21, 2014 03:13:16 ',' DD/MM/YYYY HH24:MI:SS'));))

    COMMIT;

    Insert into msidw.shp_dw_interm_tb

    (java_session_id, user_id, customer_id, client_name, carrier_id, carrier_name, is_ltl_carrier, shipper_group_id, shipper_id, shipper_name, create_date, freight_rank)

    Values

    ("E52AFB0183301775CD882C214A34F54F", 18686, 664, NULL, 22,)

    "FedEx", 0, NULL, NULL, NULL,

    TO_DATE('04/05/2014_00:00:00',_'MM/DD/YYYY_HH24:MI:SS'), 0);

    Insert into msidw.shp_dw_interm_tb

    (java_session_id, user_id, customer_id, client_name, carrier_id, carrier_name, is_ltl_carrier, shipper_group_id, shipper_id, shipper_name, create_date, freight_rank)

    Values

    ("E52AFB0183301775CD882C214A34F54F", 18686, 664, NULL, 23,)

    'DHL', 0, NULL, NULL, NULL,

    TO_DATE('04/05/2014_00:00:00',_'MM/DD/YYYY_HH24:MI:SS'), 0);

    Insert into msidw.shp_dw_interm_tb

    (java_session_id, user_id, customer_id, client_name, carrier_id, carrier_name, is_ltl_carrier, shipper_group_id, shipper_id, shipper_name, create_date, freight_rank)

    Values

    ("CA5AC1C5630D70B2E80E8E2A427DA249", 18686, 664, NULL, 21,)

    'UPS', 0, NULL, NULL, NULL,

    TO_DATE('04/05/2014_00:00:00',_'MM/DD/YYYY_HH24:MI:SS'), 0);

    Insert into msidw.shp_dw_interm_tb

    (java_session_id, user_id, customer_id, client_name, carrier_id, carrier_name, is_ltl_carrier, shipper_group_id, shipper_id, shipper_name, create_date, freight_rank)

    Values

    ("CA5AC1C5630D70B2E80E8E2A427DA249", 18686, 664, NULL, 22,)

    "FedEx", 0, NULL, NULL, NULL,

    TO_DATE('04/05/2014_00:00:00',_'MM/DD/YYYY_HH24:MI:SS'), 0);

    Insert into msidw.shp_dw_interm_tb

    (java_session_id, user_id, customer_id, client_name, carrier_id, carrier_name, is_ltl_carrier, shipper_group_id, shipper_id, shipper_name, create_date, freight_rank)

    Values

    ("CA5AC1C5630D70B2E80E8E2A427DA249", 18686, 664, NULL, 23,)

    'DHL', 0, NULL, NULL, NULL,

    TO_DATE('04/05/2014_00:00:00',_'MM/DD/YYYY_HH24:MI:SS'), 0);

    Insert into msidw.shp_dw_interm_tb

    (java_session_id, user_id, customer_id, client_name, carrier_id, carrier_name, is_ltl_carrier, shipper_group_id, shipper_id, shipper_name, create_date, freight_rank)

    Values

    ("E52AFB0183301775CD882C214A34F54F", 18686, 664, NULL, 21,)

    'UPS', 0, NULL, NULL, NULL,

    TO_DATE('04/05/2014_00:00:00',_'MM/DD/YYYY_HH24:MI:SS'), 0);

    COMMIT;

    This is the query:

    SELECT

    DER_COST_PER_POUND_INTL_MONTH. BILL_DATE_M,

    DER_COST_PER_POUND_INTL_MONTH. SERVICE,

    DER_COST_PER_POUND_INTL_MONTH. WEIGHT,

    DER_SPEND_BY_SERV_INTL_MONTHLY. COST

    Of

    (

    SELECT CUSTOMER_ID, CARRIER_ID, to_char (SHP_DW_TEMP_DEL_WEIGHT_TB. BILL_DATE, 'MM - YY') as BILL_DATE_M,

    (CASE

    WHEN (LIKE '% GROUND INTERNATIONAL %' service

    OR service LIKE '% INTERNATIONAL HOME DELIVERY %'

    OR a service LIKE ' % international airport FEDEX GROUND-PRP %'

    OR a service LIKE ' % international airport FEDEX GROUND-RTLABEL %'

    OR a service LIKE '% international airport FEDEX GROUND %'

    OR service LIKE ' % STANDARD.

    OR service LIKE ' % worldwide %.

    )

    AND (NOT LIKE '% FEDEX INTL ECONOMY FRT %' service

    AND service NOT LIKE ' % of the ECONOMY of FEDEX INTL.

    "AND NOT AS service ' % airport % OF CARGO OF the ECONOMY".

    "AND NOT AS service ' % airport % OF the ECONOMY.

    AND NOT LIKE '% ECONOMY MAILSERVICE % INTL' service

    AND NOT LIKE «% % ECONOMY» service

    AND NOT LIKE '% FEDEX EXPRESS SAVER % INTL' service

    AND NOT LIKE '% WW SAVER %' service

    AND NOT LIKE '% CANADIAN % SAVER' service

    AND NOT LIKE '% UPS SAVER %' service

    AND NOT LIKE '% FEDEX INTL PRIORITY FRT %' service

    AND NOT LIKE '% FEDEX INTL PRIORITY %' service

    AND NOT LIKE '% MAILSERVICE INTL PRIORITY %' service

    AND service NOT AS '% PRIORITY % PROPOSED international airport'

    AND service NOT AS

    'INTERNATIONAL PRIORITY DIRECTDISTRIBUTION % AIRPORT %'

    AND service NOT LIKE '% ACCELERATED %.

    AND service NOT AS ' % international airport 1 DAY FREIGHT %'

    AND service NOT AS ' international airport FIRST NIGHT % %'

    AND NOT AS '% FEDEX INTERNATIONAL FIRST' service

    AND service NOT AS '% international airport MAILSERVICE-BONUS %'

    AND service NOT AS '% UNKNOWN CODE % BASIC SERVICES international airport'

    )

    THEN "ground".

    END

    ) service.

    weight,

    shipper_id

    OF SHP_DW_TEMP_DEL_WEIGHT_TB

    where

    SHP_DW_TEMP_DEL_WEIGHT_TB. BILL_DATE > = trunc (add_months ((CASE WHEN sysdate < next_day (trunc (sysdate, 'MY')-1, 'MONDAY'), trunc(sysdate,'MON')-1 ELSE END sysdate), - 12), "MM") and SHP_DW_TEMP_DEL_WEIGHT_TB. BILL_DATE < trunc (last_day (add_months ((CASE WHEN sysdate < next_day (trunc (sysdate, 'MY')-1, 'MONDAY'), trunc(sysdate,'MON')-1 ELSE END sysdate), - 1)))

    and extract (bill_date months) = 02

    and customer_id = 664

    GROUP BY

    CARRIER_ID, CUSTOMER_ID, to_char (SHP_DW_TEMP_DEL_WEIGHT_TB. BILL_DATE, "MM - YY"), service, weight, SHIPPER_ID

    ) DER_COST_PER_POUND_INTL_MONTH,.

    (

    SELECT CUSTOMER_ID, CARRIER_ID, to_char (SHP_DW_TEMP_DEL_SPEND_TB. BILL_DATE, 'MM - YY') as BILL_DATE_M,

    (CASE

    WHEN (LIKE '% GROUND INTERNATIONAL %' service

    OR service LIKE '% INTERNATIONAL HOME DELIVERY %'

    OR a service LIKE ' % international airport FEDEX GROUND-PRP %'

    OR a service LIKE ' % international airport FEDEX GROUND-RTLABEL %'

    OR a service LIKE '% international airport FEDEX GROUND %'

    OR service LIKE ' % STANDARD.

    OR service LIKE ' % worldwide %.

    )

    AND (NOT LIKE '% FEDEX INTL ECONOMY FRT %' service

    AND service NOT LIKE ' % of the ECONOMY of FEDEX INTL.

    "AND NOT AS service ' % airport % OF CARGO OF the ECONOMY".

    "AND NOT AS service ' % airport % OF the ECONOMY.

    AND NOT LIKE '% ECONOMY MAILSERVICE % INTL' service

    AND NOT LIKE «% % ECONOMY» service

    AND NOT LIKE '% FEDEX EXPRESS SAVER % INTL' service

    AND NOT LIKE '% WW SAVER %' service

    AND NOT LIKE '% CANADIAN % SAVER' service

    AND NOT LIKE '% UPS SAVER %' service

    AND NOT LIKE '% FEDEX INTL PRIORITY FRT %' service

    AND NOT LIKE '% FEDEX INTL PRIORITY %' service

    AND NOT LIKE '% MAILSERVICE INTL PRIORITY %' service

    AND service NOT AS '% PRIORITY % PROPOSED international airport'

    AND service NOT AS

    'INTERNATIONAL PRIORITY DIRECTDISTRIBUTION % AIRPORT %'

    AND service NOT LIKE '% ACCELERATED %.

    AND service NOT AS ' % international airport 1 DAY FREIGHT %'

    AND service NOT AS ' international airport FIRST NIGHT % %'

    AND NOT AS '% FEDEX INTERNATIONAL FIRST' service

    AND service NOT AS '% international airport MAILSERVICE-BONUS %'

    AND service NOT AS '% UNKNOWN CODE % BASIC SERVICES international airport'

    )

    THEN "ground".

    END

    ) service.

    COST,

    SHIPPER_ID

    OF SHP_DW_TEMP_DEL_SPEND_TB

    where

    SHP_DW_TEMP_DEL_SPEND_TB. BILL_DATE > = trunc (add_months ((CASE WHEN sysdate < next_day (trunc (sysdate, 'MY')-1, 'MONDAY'), trunc(sysdate,'MON')-1 ELSE END sysdate), - 12), "MM") and SHP_DW_TEMP_DEL_SPEND_TB. BILL_DATE < trunc (last_day (add_months ((CASE WHEN sysdate < next_day (trunc (sysdate, 'MY')-1, 'MONDAY'), trunc(sysdate,'MON')-1 ELSE END sysdate), - 1)))

    and extract (bill_date months) = 02

    and customer_id = 664

    GROUP OF CUSTOMER_ID, CARRIER_ID, to_char (SHP_DW_TEMP_DEL_SPEND_TB. BILL_DATE, "MM - YY"), service, COST, SHIPPER_ID

    ) DER_SPEND_BY_SERV_INTL_MONTHLY,.

    SHP_DW_INTERM_TB

    WHERE

    (NVL (DER_SPEND_BY_SERV_INTL_MONTHLY. CUSTOMER_ID,-1) = NVL (DER_COST_PER_POUND_INTL_MONTH. CUSTOMER_ID,-1))

    AND (DER_SPEND_BY_SERV_INTL_MONTHLY. CARRIER_ID = DER_COST_PER_POUND_INTL_MONTH. CARRIER_ID)

    AND (DER_SPEND_BY_SERV_INTL_MONTHLY. BILL_DATE_M = DER_COST_PER_POUND_INTL_MONTH. BILL_DATE_M)

    AND (DER_SPEND_BY_SERV_INTL_MONTHLY. SERVICE = DER_COST_PER_POUND_INTL_MONTH. (SERVICE) - MNKB

    AND (NVL (DER_SPEND_BY_SERV_INTL_MONTHLY. SHIPPER_ID,-1) = NVL (DER_COST_PER_POUND_INTL_MONTH. SHIPPER_ID,-1))

    AND (NVL (SHP_DW_INTERM_TB. CUSTOMER_ID,-1) = NVL (DER_COST_PER_POUND_INTL_MONTH. CUSTOMER_ID,-1))

    AND (SHP_DW_INTERM_TB. CARRIER_ID = DER_COST_PER_POUND_INTL_MONTH. CARRIER_ID)

    AND (NVL (SHP_DW_INTERM_TB. SHIPPER_ID,-1) = NVL (DER_COST_PER_POUND_INTL_MONTH. SHIPPER_ID,-1))

    AND

    (

    SHP_DW_INTERM_TB. JAVA_SESSION_ID in ('CA5AC1C5630D70B2E80E8E2A427DA249')

    AND

    SHP_DW_INTERM_TB. User_id in (18686)

    AND

    SHP_DW_INTERM_TB.IS_LTL_CARRIER (0)

    )

    GROUP BY

    DER_COST_PER_POUND_INTL_MONTH. BILL_DATE_M,

    DER_COST_PER_POUND_INTL_MONTH. WEIGHT,

    DER_SPEND_BY_SERV_INTL_MONTHLY. COST,

    DER_COST_PER_POUND_INTL_MONTH. SERVICE

    order of DER_COST_PER_POUND_INTL_MONTH.service

    The result I want is

    Billing date

    Service Weight Cost
    04/02/14
    On the ground
    121
    167.73
    11/02/14
    On the ground
    243
    181.19
    18/02/2014
    On the ground
    729
    959.85
    25/02/2014
    On the ground
    602
    356.65

    The above query gives each weight mapped to each cost, so the resulting values are summarizing to greater value than the above expected values.

    Can someone help me please how do I change my request to get my desired result.

    Kind regards

    Mr Kishore N. badin.

    SELECT DER_COST_PER_POUND_INTL_MONTH. BILL_DATE_M,

    DER_COST_PER_POUND_INTL_MONTH. SERVICE,

    DER_COST_PER_POUND_INTL_MONTH. WEIGHT,

    DER_SPEND_BY_SERV_INTL_MONTHLY. COST

    IN (SELECT CUSTOMER_ID,

    CARRIER_ID,

    TO_CHAR (SHP_DW_TEMP_DEL_WEIGHT_TB. BILL_DATE, 'DD-MM-YY') as BILL_DATE_M,

    BOX WHEN (LIKE '% GROUND INTERNATIONAL %' service

    OR service LIKE '% INTERNATIONAL HOME DELIVERY %'

    OR a service LIKE ' % international airport FEDEX GROUND-PRP %'

    OR a service LIKE ' % international airport FEDEX GROUND-RTLABEL %'

    OR a service LIKE '% international airport FEDEX GROUND %'

    OR service LIKE ' % STANDARD.

    OR service LIKE ' % worldwide %.

    )

    AND (NOT LIKE '% FEDEX INTL ECONOMY FRT %' service

    AND service NOT LIKE ' % of the ECONOMY of FEDEX INTL.

    "AND NOT AS service ' % airport % OF CARGO OF the ECONOMY".

    "AND NOT AS service ' % airport % OF the ECONOMY.

    AND NOT LIKE '% ECONOMY MAILSERVICE % INTL' service

    AND NOT LIKE «% % ECONOMY» service

    AND NOT LIKE '% FEDEX EXPRESS SAVER % INTL' service

    AND NOT LIKE '% WW SAVER %' service

    AND NOT LIKE '% CANADIAN % SAVER' service

    AND NOT LIKE '% UPS SAVER %' service

    AND NOT LIKE '% FEDEX INTL PRIORITY FRT %' service

    AND NOT LIKE '% FEDEX INTL PRIORITY %' service

    AND NOT LIKE '% MAILSERVICE INTL PRIORITY %' service

    AND service NOT AS '% PRIORITY % PROPOSED international airport'

    AND service NOT AS '% airport international PRIORITY DIRECTDISTRIBUTION %'

    AND service NOT LIKE '% ACCELERATED %.

    AND service NOT AS ' % international airport 1 DAY FREIGHT %'

    AND service NOT AS ' international airport FIRST NIGHT % %'

    AND NOT AS '% FEDEX INTERNATIONAL FIRST' service

    AND service NOT AS '% international airport MAILSERVICE-BONUS %'

    AND service NOT AS '% UNKNOWN CODE % BASIC SERVICES international airport'

    )

    THEN "ground".

    END of service,

    weight,

    shipper_id

    OF SHP_DW_TEMP_DEL_WEIGHT_TB

    where SHP_DW_TEMP_DEL_WEIGHT_TB. BILL_DATE > =.

    trunc (add_months (BOX WHEN sysdate< next_day(trunc(sysdate,'mon')="" -="">

    'MONDAY '.

    )

    THEN trunc (sysdate, 'MY') - 1

    Of ANOTHER sysdate

    END,

    -12

    ),

    "MM".

    )

    and SHP_DW_TEMP_DEL_WEIGHT_TB. BILL_DATE

    trunc (last_day (add_months (BOX WHEN sysdate< next_day(trunc(sysdate,'mon')="" -="">

    'MONDAY '.

    )

    THEN trunc (sysdate, 'MY') - 1

    Of ANOTHER sysdate

    END,

    -1

    )

    )

    )

    and extract (bill_date months) = 02

    and customer_id = 664

    GROUP CARRIER_ID,

    CUSTOMER_ID,

    TO_CHAR (SHP_DW_TEMP_DEL_WEIGHT_TB. BILL_DATE, 'DD-MM-YY'),

    service, weight, SHIPPER_ID

    ) DER_COST_PER_POUND_INTL_MONTH,.

    (SELECT CUSTOMER_ID,

    CARRIER_ID,

    TO_CHAR (SHP_DW_TEMP_DEL_SPEND_TB. BILL_DATE, 'DD-MM-YY') as BILL_DATE_M,

    BOX WHEN (LIKE '% GROUND INTERNATIONAL %' service

    OR service LIKE '% INTERNATIONAL HOME DELIVERY %'

    OR a service LIKE ' % international airport FEDEX GROUND-PRP %'

    OR a service LIKE ' % international airport FEDEX GROUND-RTLABEL %'

    OR a service LIKE '% international airport FEDEX GROUND %'

    OR service LIKE ' % STANDARD.

    OR service LIKE ' % worldwide %.

    )

    AND (NOT LIKE '% FEDEX INTL ECONOMY FRT %' service

    AND service NOT LIKE ' % of the ECONOMY of FEDEX INTL.

    "AND NOT AS service ' % airport % OF CARGO OF the ECONOMY".

    "AND NOT AS service ' % airport % OF the ECONOMY.

    AND NOT LIKE '% ECONOMY MAILSERVICE % INTL' service

    AND NOT LIKE «% % ECONOMY» service

    AND NOT LIKE '% FEDEX EXPRESS SAVER % INTL' service

    AND NOT LIKE '% WW SAVER %' service

    AND NOT LIKE '% CANADIAN % SAVER' service

    AND NOT LIKE '% UPS SAVER %' service

    AND NOT LIKE '% FEDEX INTL PRIORITY FRT %' service

    AND NOT LIKE '% FEDEX INTL PRIORITY %' service

    AND NOT LIKE '% MAILSERVICE INTL PRIORITY %' service

    AND service NOT AS '% PRIORITY % PROPOSED international airport'

    AND service NOT AS '% airport international PRIORITY DIRECTDISTRIBUTION %'

    AND service NOT LIKE '% ACCELERATED %.

    AND service NOT AS ' % international airport 1 DAY FREIGHT %'

    AND service NOT AS ' international airport FIRST NIGHT % %'

    AND NOT AS '% FEDEX INTERNATIONAL FIRST' service

    AND service NOT AS '% international airport MAILSERVICE-BONUS %'

    AND service NOT AS '% UNKNOWN CODE % BASIC SERVICES international airport'

    )

    THEN "ground".

    END of service,

    COST,

    SHIPPER_ID

    OF SHP_DW_TEMP_DEL_SPEND_TB

    where SHP_DW_TEMP_DEL_SPEND_TB. BILL_DATE > =.

    trunc (add_months (BOX WHEN sysdate< next_day(trunc(sysdate,'mon')="" -="">

    'MONDAY '.

    )

    THEN trunc (sysdate, 'MY') - 1

    Of ANOTHER sysdate

    END,

    -12

    ),

    "MM".

    )

    and SHP_DW_TEMP_DEL_SPEND_TB. BILL_DATE

    trunc (last_day (add_months (BOX WHEN sysdate< next_day(trunc(sysdate,'mon')="" -="">

    'MONDAY '.

    )

    THEN trunc(sysdate,'MON')-1

    Of ANOTHER sysdate

    END,

    -1

    )

    )

    )

    and extract (bill_date months) = 02

    and customer_id = 664

    CUSTOMER_ID GROUP,

    CARRIER_ID,

    TO_CHAR (SHP_DW_TEMP_DEL_SPEND_TB. BILL_DATE, 'DD-MM-YY'),

    service, COST, of SHIPPER_ID

    ) DER_SPEND_BY_SERV_INTL_MONTHLY,.

    SHP_DW_INTERM_TB

    WHERE (NVL (DER_SPEND_BY_SERV_INTL_MONTHLY. CUSTOMER_ID,-1) = NVL (DER_COST_PER_POUND_INTL_MONTH. CUSTOMER_ID,-1))

    AND (DER_SPEND_BY_SERV_INTL_MONTHLY. CARRIER_ID = DER_COST_PER_POUND_INTL_MONTH. CARRIER_ID)

    AND (DER_SPEND_BY_SERV_INTL_MONTHLY. BILL_DATE_M = DER_COST_PER_POUND_INTL_MONTH. BILL_DATE_M)

    AND (DER_SPEND_BY_SERV_INTL_MONTHLY. SERVICE = DER_COST_PER_POUND_INTL_MONTH. (SERVICE) - MNKB

    AND (NVL (DER_SPEND_BY_SERV_INTL_MONTHLY. SHIPPER_ID,-1) = NVL (DER_COST_PER_POUND_INTL_MONTH. SHIPPER_ID,-1))

    AND (NVL (SHP_DW_INTERM_TB. CUSTOMER_ID,-1) = NVL (DER_COST_PER_POUND_INTL_MONTH. CUSTOMER_ID,-1))

    AND (SHP_DW_INTERM_TB. CARRIER_ID = DER_COST_PER_POUND_INTL_MONTH. CARRIER_ID)

    AND (NVL (SHP_DW_INTERM_TB. SHIPPER_ID,-1) = NVL (DER_COST_PER_POUND_INTL_MONTH. SHIPPER_ID,-1))

    AND (SHP_DW_INTERM_TB. JAVA_SESSION_ID in ('CA5AC1C5630D70B2E80E8E2A427DA249')

    AND SHP_DW_INTERM_TB. User_id in (18686)

    AND SHP_DW_INTERM_TB.IS_LTL_CARRIER (0)

    )

    GROUP OF DER_COST_PER_POUND_INTL_MONTH. BILL_DATE_M,

    DER_COST_PER_POUND_INTL_MONTH. WEIGHT,

    DER_SPEND_BY_SERV_INTL_MONTHLY. COST,

    DER_COST_PER_POUND_INTL_MONTH. SERVICE

    order DER_COST_PER_POUND_INTL_MONTH. BILL_DATE_M, DER_COST_PER_POUND_INTL_MONTH.service

    BILL_DATE_M SERVICE WEIGHT COST
    02/04/14 On the ground 121 167.73
    02/11/14 On the ground 243 181.19
    18/02/14 On the ground 729 959.85
    25/02/14 On the ground 602 356.65

    Concerning

    Etbin

Maybe you are looking for