Order by clause not working

Hi, everyone,
I am trying to use the following insert statement to insert records in asc order. if i use the select statement alone the order by clause works fine, but when i use the same sql and add a insert into table statment the order by clause does not work. I am not getting the records in ascending order. could anybody help me in this regard?
INSERT INTO cat_sales_stg
select      b.SSC,                
     ltrim(rtrim(a.CAT_DESC)) cat_desc,                
     SUM(a.AMOUNT) AMOUNT               
FROM Trans a, SSC b                     
WHERE a.ACCOUNT_NUMBER = TO_CHAR(b.ACCOUNT_NUMBER)                    
     AND a.TMONTH >= 200905 AND a.TMONTH <= 200910                
     AND a.FORMAT_NAME = 'ABC'                
     AND b.BMONTH = 200910                
     AND b.SAMPLE = 3                
     AND b.BANNER_NAME = 'ABC'               
     AND b.MODEL_NAME = 'XYZ'               
group by b.SSC, ltrim(rtrim(a.CAT_DESC))
order by ssc,cat_desc
Thanks in advance

user10636796 wrote:
Hi, everyone,
I am trying to use the following insert statement to insert records in asc orderWhat Toon, William, and others have said is that you DON'T insert rows in a specific order. That is completely outside the way relational databases are designed. You insert rows as unordered and use an ORDER BY clause in a SELECT when reading them. ORDER BY is for SELECT statements, not INSERT.
In particular Toon poined out that we can't control where individual rows get stored.
There is a databas object called a varray that can store data in sorted order. I have never seen them used because selecting the data back out again is more work; using an ordinary table and an ORDER BY clause is much easier.

Similar Messages

  • My order number does not work.  when i sign in it says no orders.  who do i speak to regarding this?

    My order number does not work.  When i sign in it just says no orders.  How do i reach anyone to actually ask what is going on.

    contact adobe support by clicking here and, when available, click 'still need help', https://helpx.adobe.com/contact.html

  • Order by is not working

    Hello,
    I'm using FORM 6i and writing the data to Excel Report
    I'm passing the string to the Order By clause. But the data is not sorted.
    Code is as follows:
    procedure test (pi_order IN VARCHAR2)
    is
    type t_data IS REF CURSOR;
    c_data t_data;
    l_order_by VARCHAR2(200);
    type data_rec IS RECORD (col1 NUMBER(2),
    col2 VARCHAR2(100));
    r_data data_rec;
    BEGIN
    IF (pi_order_by IS NULL) THEN
    l_order_by := NULL;
    ELSE
    l_order_by := pi_order_by;
    END IF;
    OPEN c_data for SELECT COL1, COL2 , pkg1.p2(x, y) col3
    FROM table_name
    WHERE col1 = 1
    ORDER BY l_order_by;
    LOOP
    FETCH c_data INTO r_data;
    EXIT WHEN c_data%NOTFOUND;
    ---- OTHER CODE HERE--
    EXCEPTION
    END;
    So, basically i'm using the REF CURSOR, and passing the order by string dynamically from the Oracle Form. The above procedure is part of PLL.
    I have verified running the script at SQL*PLUS, to test if there is any dependency on Forms. But data is not sorted in SQL*PLUS environment also.
    And also i'm using a packaged procedure as one column in the cursor query. So I can't use EXEC_SQL, which will parse the total statement once . To me known we can use EXEC_SQL, when we don't have any input parameters to the SQL statement.
    Any suggestion on passing Dynamic Order by cluase in any appraoch?
    Cheers
    Ram

    Hi
    I researched some and found this.
    It looks like you are using 'REF CURSOR WITH STATIC SQL'.
    You need REF CURSOR with DYNAMIC SQL ( put it in single quotes ).
    Read this article here:
    http://www.oracle.com/technology/oramag/oracle/04-may/o34asktom.html
    Goto this section and read ---
    Cursor or Ref Cursor
    At an interview for an Oracle PL/SQL developer job, I was asked to describe the difference between cursor and ref cursor and when you would appropriately use each of these. Could you please tell me the answer?
    Well, technically, under the covers, at the most basic level, they are the same. A typical PL/SQL cursor is static by definition. Ref cursors, on the other hand, can be dynamically opened (the query is not known until runtime) or opened by use of a set of static SQL statements, the choice of which is based on logic (an IF/THEN/ELSE block will open one or the other query). For example, the following block of code demonstrates a typical static PL/SQL cursor, cursor C. Also, it shows how you can use a ref cursor (L_CURSOR in this example) to open a query by using dynamic SQL or static SQL:
    Declare
    type rc is ref cursor;
    cursor c is select * from dual;
    l_cursor rc;
    begin
    if (to_char(sysdate,'dd') = 30)
    then
    -- ref cursor with dynamic sql
    open l_cursor for
    'select * from emp';
    elsif (to_char(sysdate,'dd') = 29)
    then
    -- ref cursor with static sql
    open l_cursor for
    select * from dept;
    else
    -- with ref cursor with static sql
    open l_cursor for
    select * from dual;
    end if;
    -- the "normal" static cursor
    open c;
    end;
    Message was edited by:
    brian952

  • [JS CS5] Re order pages script not working for me

    Hi, I'm attempting to use the reorder script marked as the answer in this post :
    http://forums.adobe.com/thread/519470
    My problem is that when it reorders the pages, it puts them all into one spread and errors once it reaches 10.
    Some details on what I am doing -
    It's an 18 page document, reorder is as follows:
    1,2,4,18,17,5,6,16,15,7,8,14,13,9,3,10,11,12
    Currently it's in spreads, but even when I turn off facing pages, move each page by itself and turn the master into one page, I still have the same error. I've been fighting with this a while, I've tried each of those by themselves as well.
    In case you are curious about the order - this is a booklet, but the middle signature is 3 pages. I'm attempting to create a script that will take it from reader to printer spreads as "print booklet" will not work because of the 3 page signature (extra page is a fold out on finished product).
    I'm fairly new to scripting and feel it must be something obvious I'm just missing.
    Thank you for your time!!

    @Krista – I suggest you ask in the thread you are pointing to with your link.
    No need to split the thread into two.
    Now to your problem:
    if all the pages end up in one spread it is no surprise that you get an error after page 10. The maximum page count of one single spread is 10.
    Why do the pages go to one spread?
    It's pure speculation, but I think it has to do with some preconditions your spreads are in.
    Check for "Allow Document Pages to Shuffle" and "Allow Selected Spread to Shuffle".
    Is "Allow Selected Spread to Shuffle" "off" or "on" for the particular spread where all pages are added?
    And another question:
    what is the particular script you refer to? There are a couple of scripts in this thread from various authors.
    Uwe

  • NVL in where clause not working with UNIX parameters

    Apparently this in a where clause does not work in UNIX scripts...
    .... and trans_date between to_date('&1','YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('&2','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    ERROR at line 14:
    ORA-01858: a non-numeric character was found where a numeric was expected
    How do I get around a null in UNIX? This works fine if both parameters are populated. Thanks.

    Jason ORCL wrote:
    Apparently this in a where clause does not work in UNIX scripts...
    .... and trans_date between to_date('&1','YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('&2','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    ERROR at line 14:
    ORA-01858: a non-numeric character was found where a numeric was expected
    How do I get around a null in UNIX? This works fine if both parameters are populated. Thanks.it's nothing to do with unix at all - your date value doesn't match the format mask that you've entered:
    '31-DEC-4712' doesn't map to 'YYYY/MM/DD HH24:MI:SS' in any universe unfortunately.

  • In clause not working

    Hi All,
    SELECT sno,mid,mname
    FROM manage_date
    WHERE mname IN
    ('KIRAN-KUMAR',
    'RAHUL-RAJ',
    'KAUSHAL-SONI');
    IF I use this query directly in DB it's working fine.
    But when this query is calling in .net using parameter as below
    it's not giving any records for more than one value.
    IN (:p_mname)
    If I pass one name 'KIRAN-KUMAR' from .net It's working.
    If I pass multiple names from .net query not returning any records.
    Please help me how to resolve this.
    Thanks.

    976208 wrote:
    Hi All,
    SELECT sno,mid,mname
    FROM manage_date
    WHERE mname IN
    ('KIRAN-KUMAR',
    'RAHUL-RAJ',
    'KAUSHAL-SONI');
    IF I use this query directly in DB it's working fine.
    But when this query is calling in .net using parameter as below
    it's not giving any records for more than one value.
    IN (:p_mname)
    If I pass one name 'KIRAN-KUMAR' from .net It's working.
    If I pass multiple names from .net query not returning any records.
    Please help me how to resolve this.
    Thanks.
    But you won't be passing multiple names in that single bind variable, you'll be passing one string of names.  Oracle is not going to magically know that just because you have commas in the string you intend to have seperate values... it doesn't work like that (and it shouldn't).
    As Karthick pointed out, it's not a case that the IN clause is not working, it's a case of you not understanding the difference between the IN clause requiring a set of values as opposed to a single value, so you should read the FAQ link which points to useful information about how to deal with such situations.

  • Download link from order e-mail not working 'page error'

    I ordered Adobe Photoshop Elements 10 & Adobe Premiere Elements 10 back in Nov2011.  I downloaded both to learn I needed the 64 bit version.  When I had time I downloaded Photoshop Elements 64 bit and got my project done.  Now I went back to get my 64 bit version of Premiere but the link no longer works.  On the order it says you can re-download anytime.  I sign in to my Adobe Account, go to Order History, hover over download - I see the address in my browser status bar at bottom left.  When I click on download the the status bar displays the yellow triangle with the warning message 'page error'  when you expand the message it indicates a address is not working.  I tried turning my firewall off - didn't have to do that before - but same message.  There must be a link where paying customers can get the proper download?  Everything I find is for the trial version.  Is there a link?  Why do the links in the order e-mail expire?  Thanks in advance!            

    OK, I finally worked around the issue.  Right click on the word download – then select open in new window.  Not sure why this worked – but it did.  Jeff, the alternate download option does appear on the second page that loads AFTER you get past the initial download link.  Though once I got there I was able to use the primary download for 64 bit.  Thanks all for looking at this.  J potter, try this and see if it helps.

  • Recovery media kit order web page not working for Canada site

    The laptop crashed (Pavilion G6-2288ca with Windows 8). I'm planning to replace the hard drive. I want to order the recovery media kits from hp but the Canada site is not working. After I entered the postal code, the site says it is temperarily out of service. I tried the same on the US site with a pretended zipcode and it worked fine. Can someone please help?
    Thanks.

    Try phoning HP Support. 1-800-474-6836
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • Incoming orders in COPA not working if Sales Order blocked for Credit Check

    Hi all,
    We need to build a report showing all incoming sales order by entry date and/or change date (change of values or quantities later on). COPA allows to do this, but the problem is that COPA line item table is only updated if the sales order is released from credit check (VKM3). I am looking for a solution to be able to record sales orders in COPA even if they are still blocked for credit check. By doing that we will be able to report all sales orders entered from COPA and provide basis for commissions calculation to the business.
    I have investigated possible COPA enhancements like COPA0005 but it doesn't seem to be used at the time of sales order save.
    Thanks.

    Hello ,
    Thanks for the reply
    As you said , the credit check in the service order is information message "Credit check (maximum percentage for ope
    exceeded)" .
    If you enter and come out this message then one more message will come , i.e., "The business transaction can not be carried out" detail message -  System status CNOK is active (ORD XXXXXXX).
    with the above message , system will not allow to do the Service order release.
    In this particular case , we have done the VKM1 for the sales order to unblock the order from credit check . But again system is checking the credit check at service order (created w.r.t sales order) . we are not able to control this .
    we also suggested the solution to the customer , saying removal of credit check for service orders . But customer requires credit check to happen at both the documents.

  • Process order settlement Ko88 not working.

    Hello Sapients,
    i am getting a message:"There are no accrued amounts; settlement is not possible."
    Following are the steps i cariried.
    1.) created a Process order CR01
    2.) did goods issue to the process order using MIGO_GI
    3.) when i run KKAX I am able to the costs in WIP.
    4.) but when i execute the ko88 for the particular process order systme is not settling any but instead giving me a message: "There are no accrued amounts; settlement is not possible."
    5.) Could you please advise if I am missing any thing.
    Thanks and Regards
    Ravi

    Hi Ravi,
    Please, check if you have run the settlement already for period that you wants to do the settle by path  KO88 -> goto -> previous settlement or by  extras -> activate flow trace at Ko88 to analysis the problem.
    Please, also verify the SAP note 179533. This note has some informations regarding the problem.
    Regards,
    Paulo

  • EQUAL condition on WHERE clause not working

    Hi,
    Can someone please tell me why the following WHERE clause  (marked with ***** below) is not finding any EQUAL conditions?
    I know that table i_cust_mast is populated with several thousand rows and that there ARE matching rows in KNVP.
    Here is the code as I have it:
    TYPES:
          BEGIN OF t_cust_mast,
            kunnr TYPE kunnr,
            name1 TYPE name1_gp,
            name2 TYPE name2_gp,
            stras TYPE stras_gp,
            adrnr TYPE adrnr,
            ort01 TYPE ort01_gp,
            regio TYPE regio,
            pstlz TYPE pstlz,
            vkbur TYPE vkbur,
            konda TYPE konda,
            sortl TYPE sortl,
            katr1 TYPE katr1,
            katr2 TYPE katr2,
            katr3 TYPE katr3,
            katr4 TYPE katr4,
            katr5 TYPE katr5,
            katr6 TYPE katr6,
            katr7 TYPE katr7,
            katr8 TYPE katr8,
            katr9 TYPE katr9,
            katr10 TYPE katr10,
            bzirk TYPE bzirk,
            vkgrp TYPE vkgrp,
            kdgrp TYPE kdgrp,
            klabc TYPE klabc,
            kondaa TYPE konda,
            kalks TYPE kalks,
            pltyp TYPE pltyp,
            hityp TYPE hityp_kh,
            hkunnr TYPE hkunnr_kh,
            datab TYPE datab,
            datbi TYPE datbi,
            lzone TYPE lzone,
          parvw TYPE parvw,
            kunn2 TYPE kunn2,
            kunn2a TYPE kunn2,
            kunn2b TYPE kunn2,
            kunn2c TYPE kunn2,
            kunn2d TYPE kunn2,
            kunn2e TYPE kunn2,
            kunn2f TYPE kunn2,
            kunn2g TYPE kunn2,
            parza TYPE parza,
            ktokd TYPE ktokd,
            loevm TYPE loevm_x,
          END OF t_cust_mast .
        TYPES:
          BEGIN OF t_part_func,
            kunnr TYPE kunnr,
            parvw type parvw,
            kunn2 TYPE kunn2,
            parza type parza,
          END OF t_part_func .
        TYPES:
          t_t_cust_mast TYPE STANDARD TABLE OF t_cust_mast,
          t_t_part_func TYPE STANDARD TABLE OF t_part_func.
        DATA: i_cust_mast TYPE t_t_cust_mast,
              i_part_func TYPE t_t_part_func.
      CONSTANTS: c_type_a TYPE msgty VALUE 'A'.
      FIELD-SYMBOLS: <x_cm> LIKE LINE OF i_cust_mast.
    Get Customer Master Data
      SELECT
       hkunnr hname1 hname2 hstras hadrnr hort01 h~regio
       hpstlz ivkbur ikonda hsortl hkatr1 hkatr2 h~katr3
       hkatr4 hkatr5 hkatr6 hkatr7 hkatr8 hkatr9 h~katr10
       ibzirk ivkgrp ikdgrp iklabc ikonda ikalks i~pltyp
       khityp khkunnr kdatab kdatbi h~lzone
       hktokd hloevm
      INTO TABLE i_cust_mast " up to 50 rows
      FROM kna1 AS h
      JOIN knvv AS i ON ikunnr = hkunnr
      JOIN knvh AS k ON hityp = c_type_a   " 'A'
                    AND kkunnr = ikunnr
                    AND kvkorg = ivkorg
                    AND kvtweg = ivtweg
                    AND kspart = ispart
                    AND k~datab <= sy-datum
                    AND k~datbi >= sy-datum.
      IF sy-subrc = 0.
        SORT i_cust_mast[] BY kunnr.
      ENDIF.
    Get Partner Function Data for each Customer Master Record
      LOOP AT i_cust_mast ASSIGNING <x_cm>.
        SELECT hkunnr hparvw hkunn2 hparza
          INTO TABLE i_part_func
        FROM knvp AS h
          WHERE h~kunnr = <x_cm>-kunnr.        ***** WHERE clause not finding any matches *****
      ENDLOOP.
    Thanks!!!
    Andy

    TYPES:
          BEGIN OF t_cust_mast,
            kunnr TYPE kunnr,
            name1 TYPE name1_gp,
            name2 TYPE name2_gp,
            stras TYPE stras_gp,
            adrnr TYPE adrnr,
            ort01 TYPE ort01_gp,
            regio TYPE regio,
            pstlz TYPE pstlz,
            vkbur TYPE vkbur,
            konda TYPE konda,
            sortl TYPE sortl,
            katr1 TYPE katr1,
            katr2 TYPE katr2,
            katr3 TYPE katr3,
            katr4 TYPE katr4,
            katr5 TYPE katr5,
            katr6 TYPE katr6,
            katr7 TYPE katr7,
            katr8 TYPE katr8,
            katr9 TYPE katr9,
            katr10 TYPE katr10,
            bzirk TYPE bzirk,
            vkgrp TYPE vkgrp,
            kdgrp TYPE kdgrp,
            klabc TYPE klabc,
            kondaa TYPE konda,
            kalks TYPE kalks,
            pltyp TYPE pltyp,
            hityp TYPE hityp_kh,
            hkunnr TYPE hkunnr_kh,
            datab TYPE datab,
            datbi TYPE datbi,
            lzone TYPE lzone,
          parvw TYPE parvw,
            kunn2 TYPE kunn2,
            kunn2a TYPE kunn2,
            kunn2b TYPE kunn2,
            kunn2c TYPE kunn2,
            kunn2d TYPE kunn2,
            kunn2e TYPE kunn2,
            kunn2f TYPE kunn2,
            kunn2g TYPE kunn2,
            parza TYPE parza,
            ktokd TYPE ktokd,
            loevm TYPE loevm_x,
          END OF t_cust_mast .
        TYPES:
          BEGIN OF t_part_func,
            kunnr TYPE kunnr,
            parvw type parvw,
            kunn2 TYPE kunn2,
            parza type parza,
          END OF t_part_func .
        TYPES:
          t_t_cust_mast TYPE STANDARD TABLE OF t_cust_mast,
          t_t_part_func TYPE STANDARD TABLE OF t_part_func.
        DATA: i_cust_mast TYPE t_t_cust_mast,
              i_part_func TYPE t_t_part_func. 
    CONSTANTS: c_type_a TYPE msgty VALUE 'A'.
      FIELD-SYMBOLS: <x_cm> LIKE LINE OF i_cust_mast.
    Get Customer Master Data
      SELECT
       hkunnr hname1 hname2 hstras hadrnr hort01 h~regio
       hpstlz ivkbur ikonda hsortl hkatr1 hkatr2 h~katr3
       hkatr4 hkatr5 hkatr6 hkatr7 hkatr8 hkatr9 h~katr10
       ibzirk ivkgrp ikdgrp iklabc ikonda ikalks i~pltyp
       khityp khkunnr kdatab kdatbi h~lzone
       hktokd hloevm
      INTO TABLE i_cust_mast " up to 50 rows
      FROM kna1 AS h
      JOIN knvv AS i ON ikunnr = hkunnr
      JOIN knvh AS k ON hityp = c_type_a   " 'A'
                    AND kkunnr = ikunnr
                    AND kvkorg = ivkorg
                    AND kvtweg = ivtweg
                    AND kspart = ispart
                    AND k~datab <= sy-datum
                    AND k~datbi >= sy-datum.
      IF sy-subrc = 0.
        SORT i_cust_mast[] BY kunnr.
      ENDIF.
    Get Partner Function Data for each Customer Master Record
      LOOP AT i_cust_mast ASSIGNING <x_cm>.
        SELECT hkunnr hparvw hkunn2 hparza
          INTO TABLE i_part_func
        FROM knvp AS h
          WHERE h~kunnr = <x_cm>-kunnr.
      ENDLOOP.

  • Select in FROM clause not working

    Hello,
    I have three tables with one table containing the name of the other two tables and i want to select dynamically the two selects based on their ID that matches in the first table.
    CREATE TABLE_NAMES (ID NUMBER, TableName VARCHAR(2) )
    CREATE TRADE (activites VARCHAR(2), TRADE_ID )
    CREATE CONTRACT(activites VARCHAR(2), TRADE_ID )
    INSERT INTO TABLE_NAMES ( 101, 'TRADE' );
    INSERT INTO TABLE_NAMES ( 202, 'CONTRACT' );
    INSERT INTO TRADE ('TRADE 1' , 101 )
    INSERT INTO CONTRACT ('CONTRACT 1' , 202 )
    What I wanted to do is select the table name dynamically based up on the id in TABLE_NAMES
    and I failed when doing this
    SELECT SELECTED_TABLE.activites FROM ( SELECT TABLE_NAME FROM TABLE_NAMES WHERE ID = 101 ) SELECTED_TABLE
    OR a more generic form with JOIN statement also did not work
    SELECT SELECTED_TABLE.activities FROM TABLE_NAMES SELECTION JOIN ( SELECT TABLE_NAME FROM TABLE_NAMES) SELECTED_TABLE
    ON SELECTION.ID = SELECTED_TABLE.TRADE_ID
    Thanks in advance

    What you are trying to do will not work. To accomplish your requirement you would have to use dynamic SQL.
    However, I want to stress that this is probably not a good design decision because:
    1. Maintainability of the code may be jeopardized
    2. Dynamic SQL could be laden with SQL injection vulnerabilities
    3. Dynamic SQL generally does not perform as well as static SQL.
    HTH!

  • Why is the GROUP BY clause not working in my Query?

    Dear All,
    Below is the Query for a Summary Debtors Aged Analysis.
    The GROUP BY clause does not seem to be working.
    The Query returns all the unpaid invoices, instead of a single total row for each Customer.
    If a Customer X has 10 unpaid invoices, 10 rows are displayed - one for each invoice.
    I was expecting only 1 row for Customer X, 1 for Customer Y, etc.
    This is what GROUP BY is supposed to do, but it is not doing its work.
    What has gone wrong?
    Thanks
    Leon Lai
    Here's my Query:
    declare @taxdt datetime
    set @taxdt
    /*select 1 from jdt1 t0 where t0.TaxDate*/ = [%1]
    SELECT
    CASE
                 WHEN T0.Account = 1220101 THEN 'Prim Cust'
                 WHEN T0.Account = 1220102 THEN 'Fgn Cust'
                 WHEN T0.Account = 1220103 THEN 'Local Cust'
                 WHEN T0.Account = 1220104 THEN 'Staff Loan' 
                 WHEN T0.Account = 1220105 THEN 'Dep with TP'
                 WHEN T0.Account = 1220106 THEN 'Adv to Cust'
                 WHEN T0.Account = 1220108 THEN 'Sund Drs'
                 ELSE 'Error ! ! !'
    END AS 'Control A/c',
    T1.CardCode AS 'BP Code',
    T2.Notes2 AS 'BP Name',
    SUM ((T0.Debit - T0.Credit)) AS 'Orig. Rs',       
    SUM ((T0.BalDueDeb - T0.BalDueCred)) AS 'Bal. Rs',     
    ((SELECT SUM(T0.BalDueDeb) - Sum(T0.BalDueCred)
        WHERE DateDiff(mm, T0.TaxDate, @taxdt) = 1))    
        AS '1 Mth Ago' 
    /* Similarly for other age brackets*/
    FROM JDT1 T0
    INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
    LEFT OUTER JOIN OCPR T2 ON T1.CardCode = T2.Cardcode
    LEFT OUTER JOIN OJDT T3 ON T0.TransID = T3.TransID
    LEFT OUTER JOIN OINV  T4 ON T3.TransID = T4.TransID
    LEFT OUTER JOIN ORIN  T5 ON T3.TransID = T5.TransID
    WHERE
    T1.CardType = 'C'
    and (Balance) != 0
    and (T0.BalDueDeb - T0.BalDueCred) != 0
    GROUP BY T0.Account, T1.CardCode, T2.Notes2, T0.TaxDate

    Dear Neetu,
    Thanks for your reply.
    This Query is a modification of the Query you posted in SAP B1 SQL TIPS & TRICKS
    http://wiki.sdn.sap.com/wiki/display/B1/SAPB1SQLB-FNDebtorsAgingReportbydate
    So, maybe instead of referring to my Query, let's refer to yours. It may be easier for you to understand me.
    Once I understand the problem, I can adapt your query to suit my requirements
    So, let's start with a clean slate:
    The Query you have posted is for a DETAILED Debtors Aging Report.
    This lists all outstanding invoices, and ages them in the Age Brackets.
    What I want is a SUMMARY Debtors Aging Report.
    This will give the total amount owed by each Customer, and this amount is broken down in the Age Bracket Columns
    There will be a single row listed for each customer, something like this:
    Customer     Total Due     Current      1 Mth          2 Mth         3 Mth  etc
    Alfred       500,000       300,000       200,000
    Charles      800,000                     100,000       300,000       400,000
    How can you modify your query to make it become a Summary Report (1 line for each customer even if he has many invoices)?
    Thanks
    Leon Lai
    Here's your code
    SELECT T1.CardCode, T1.CardName, T1.CreditLine, T0.RefDate, T0.Ref1 'Document Number',
         CASE  WHEN T0.TransType=13 THEN 'Invoice'
              WHEN T0.TransType=14 THEN 'Credit Note'
              WHEN T0.TransType=30 THEN 'Journal'
              WHEN T0.TransType=24 THEN 'Receipt'
              END AS 'Document Type',
         T0.DueDate, (T0.Debit- T0.Credit) 'Balance'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')<=-1),0) 'Future'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=0 and DateDiff(day, T0.DueDate,'[%1]')<=30),0) 'Current'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>30 and DateDiff(day, T0.DueDate,'[%1]')<=60),0) '31-60 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>60 and DateDiff(day, T0.DueDate,'[%1]')<=90),0) '61-90 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>90 and DateDiff(day, T0.DueDate,'[%1]')<=120),0) '91-120 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=121),0) '121+ Days'
    FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
    WHERE (T0.MthDate IS NULL OR T0.MthDate > [%1]) AND T0.RefDate <= [%1] AND T1.CardType = 'C'
    ORDER BY T1.CardCode, T0.DueDate, T0.Ref1

  • Maintain order at runtime not working for MDM in PI 7.31

    Hi All
    I have and one outbound and 5 inbound interfaces all going to MDM system
    first one is import and next 4 are webservice calls to MDM multiple times but the mapping changes for each.
    So I kept 5 different operation mappings for 5 inbound interfaces and maintain order at runtime in receiver interfaces
    The first one import if fails in MDM due to value exception or any exception, MDM PI adapter is not catching that and the other interfaces are executed
    So the maintain order at runtime is not useful in my case. do we know why is this behaviour? can we make sure the import is successfully completed before the next interface execution using maintain order at runtime?
    thx
    mike

    Hi Mike,
    I'm not sure if this is still relevant or even up to date. The MDM adapter is/was nothing more than the old file integration with enhanced audit log. So, unfortunately, it will tell you all about the import successes and errors in the audit log, but it will not change the message status accordingly. Regarding message status it still behaves as if it was a file receiver adapter stopping transaction at file system level. In my opinion, this is not very helpful, and scenarios like yours cannot be implemented using standard tools. You can't even use the standard monitor to check whether normal distributions worked. You'd have to check the audit log of every message. Or check the file system directly or read the MDM log, as before.
    I hope they improved that in the meantime.
    Regards,
    Jörg

  • HT1933 I want to cancel a order that did not work

    Othe other day I had trouble playing bingo so during I put buy on several things that came up thinking that would make it work,,,so it ended up charging me for  5 things with a total of 15.00,,,which I have not downloaded so I would like to cancel the complete order,,,and every time I put in the number on the order it says it is wrong,,,,the number is MH6SB2D71F     it says to report a problem and so I am,,,I do not want it,,,,so please take it off my bill if you can,,,please help

    Please be aware that you are not communicating with Apple when you post in these forums. The only people who will reply to your posts are your fellow users. Go here:
    http://www.apple.com/support/itunes/contact/
    and follow the instructions to report the issue to the iTunes Store.
    Regards.

Maybe you are looking for