How to get a part of wise current account with a query as my image?

Mr President.

I get the request from this forum in my previous thread, that's like that

SELECT c.name customer_name,
        p.name product_name,
        sl.sal_qty,
        sl.unit_sal_price,
        sl.sal_qty*sl.unit_sal_price AS salesvalue,
        CASE
          WHEN ROW_NUMBER () OVER (partition by c.cust_id order by p.prod_id desc,sl.sal_id desc) = 1 
   THEN
              SUM (sl.sal_qty*sl.unit_sal_price) OVER (PARTITION BY c.cust_id)
        END totals
FROM customer c 


INNER JOIN sales s ON s.cust_id = c.cust_id
INNER JOIN salesline sl ON sl.sal_id = s.sal_id
INNER JOIN product p ON p.prod_id = sl.prod_id


ORDER BY c.cust_id,p.prod_id,sl.sal_id







The above query gives this result

query.png

Now I want some changes are the query above to get the following result

running balance query.png

can any body give helpful advice

Concerning

Tender,

Maybe something like that?

SELECT c.name customer_name,
        p.name product_name,
        sl.sal_qty,
        sl.unit_sal_price,
        sl.sal_qty*sl.unit_sal_price AS salesvalue
        ,CASE
          WHEN ROW_NUMBER () OVER (partition by c.cust_id order by p.prod_id desc,sl.sal_id desc) = 1
          THEN
              SUM (sl.sal_qty*sl.unit_sal_price) OVER (PARTITION BY c.cust_id)
          END totals
        ,SUM (sl.sal_qty*sl.unit_sal_price) OVER (PARTITION BY c.cust_id ORDER BY c.cust_id, p.prod_id,sl.sal_id ) running_totals
FROM customer c
INNER JOIN sales s ON s.cust_id = c.cust_id
INNER JOIN salesline sl ON sl.sal_id = s.sal_id
INNER JOIN product p ON p.prod_id = sl.prod_id
ORDER BY c.cust_id,p.prod_id,sl.sal_id  

See you soon

AJ

Tags: Database

Similar Questions

  • How to get the part of string before and after a character

    Hi all

    How to get the string before and after the comma character)

    Ex: The string contains the value John Kennedy

    I need the output as first stirng - John

    Second stirng - Kennedy

    Create table names (fullname varchar2 (20));

    insert into values of names ("John, Kennedy");

    insert into values of names ("papa ibra, Shan");

    insert into values of names ('Don Bosco'),

    Select * from names;

    Expected results

    FullName firstname lastname

    John, Kennedy John Kennedy

    Nicolas, Nicolas Shan Shan

    Don Bosco Don Bosco

    Please let me know how to proceed

    Thank you

    Hello

    This proves what I said before, on 0 and several commas commas.

    If we add these 3 rows to the sample data you posted:

    insert into names (fullname) values ("tou").

    insert into names (fullname) values (' David, Lloyd, George ");

    insert into names (fullname) values ('J, R, R, Tolkien");

    then the query I posted earlier produced these results:

    FULLNAME FIRSTNAME LASTNAME

    -------------------- -------------------- --------------------

    John, Kennedy John Kennedy

    Nicolas, Nicolas Shan Shan

    Don Bosco Don Bosco

    TOU tou

    David Lloyd, George David Lloyd, George

    J, R, R, Tolkien J R, R, Tolkien

    If you prefer to get these results:

    FULLNAME FIRSTNAME LASTNAME

    -------------------- -------------------- --------------------

    John, Kennedy John Kennedy

    Nicolas, Nicolas Shan Shan

    Don Bosco Don Bosco

    TOU tou

    David Lloyd, George David, Lloyd George

    J, R, R, J, R, R Tolkien Tolkien

    then you just change line 1:

    WITH got_commapos AS

    (

    SELECT FullName

    , INSTR (fullname, ','-1) AS commapos-* CHANGED *.

    Names

    )

    SELECT FullName

    , SUBSTR (fullname, commapos 1, -1) AS a first name

    SUBSTR (fullname, commapos + 1) in the FORM name

    OF got_commapos

    ;

  • How to get the list permissions wise page name or menu-wise

    Hello

    I want to know this authorization list associated with a specific page or a menu. Please help me how to get that

    Check the following on the internet regarding the area of authorizedaction, which contains the information you need.

    http://peoplesoftwiki.blogspot.nl/2009/12/finding-barname-ItemName-and-all-about.html

    you want to hide the PeopleTools menu? If so, mke sure (s) he doesn't have the permision list that grants the permissions so that you do not want.

  • How to get the language of the current session?

    Hello
    I want to get the language of the current session.
    I use pageContext.getOANLSServices () m:System.NET.SocketAddress.ToString () but its output is oracle.apps.fnd.framework.OANLSServices@f55137

    Any ideas?

    Thank you

    Hello

    Use the code below in CO to get the language.

    pageContext.getCurrentLanguage();
    

    Kind regards
    GYAN

  • How to get the name of the current PDF file?

    Hello world

    I know this is maybe a question has been asked millions of times, but I couldn't find a straight answer.

    I am using a workflow that comes with a Content Manager Solution is not Adobe this WF will generate a file very long (about 30 characters) name that will be used as the number of unique processes.

    To go to the step next in the workflow that I have to update the table in the database and registration update will use the process number.  What I did is that I added a field in hidden text in the form, which should have the number of processes on the initialize function.

    Now my question is how to get the file name of the opened PDF file?

    I'm sure that there is a function in JS, but I couldn't find the way to do it.

    Thanks in advance guys for help.

    Mazen

    Acrobat can create LiveCycle Design possible forms, but each uses a different and different languages or syntax approach.

    There are a number of ways to get the file name and path, urt getFileName.

  • How do I get the data of "Regulatory BOM" Formulation with SQL query output

    Hello

    We would like to implement a State of BiPublisher that displays "Regulation BOM" (wording-> click on TAB Formulation on exit Popup-> TAB Composition) information table.

    How could get us this information with an SQL query?

    Thank you

    Annarosa

    Hi, given 'Regulatory BOM' output of the Formulation are more complicated than expected. Attached is an example. You can test and make the appropriate changes to your report.

  • How to get the value of the point messagetextInput with attr 'secret' to the value 'true '.

    Hi all
    I create a messagetextInput item and set its 'secrets' attribute to "true".
    When I want to get its value to help
    OAMessageTextInputBean = newPwdBean1
    (OAMessageTextInputBean) webBean.findChildRecursive ("NewPwd1");
    newPwd1 = (String) newPwdBean1.getValue (pageContext);

    It returns null.

    Could someone tell me please how to get its value?

    I did the same to help
    Password String = (String) pageContext.getParameter ("");

    Thank you

  • How to get the original look of firefox 4 with "firefox button" on the road to top then bookmarks with the address bar... ?

    I've been using firefox 3.6.16 and just upgraded to version 4 yesterday evening. in fact, the problem is this, in my browser that "firefox" button and all tabes are displayed in the same way on top.

    what I want is to get the default appearance of firefox 4 with firefox button on top and all of the tabs that appear on located below this button... (not in the same way)

    I manage because of any parameter of preference or other? Help, please

    If the Firefox window is maximized, it displays the tabs of the same line that the Firefox button, it just displays them on a separate line on a window not optimized in terms.

  • How to get the value of row current table when press the button submit

    Hello

    I want to get the current value of the SuccessionPlanId line which is part of the column in a table that is advanced.

    I created a (created using customization, from action through CO) button in the table as column, so each line with a single key, if I press the button of the first line means so I want to extract the first line SuccessionPlanId and if it's the 3rd way so I want to get the value of the value of the third row.

    How in the post of controller?

    Please answer soon, its urgency.

    Thanks in advance,
    SAN

    OK, need to go with a delicate way,

    1.) create a new table with Jdeveloper and there shud be a replica of the room once except the button submit newly added, pls note button type shud be present the type of button.

    2.) hide the existing table area and create a new stacklayoutbean.

    (3.) this stacklayout bean will have the property to extend, you give the full path of the new custom of advanced table box.

    Now you should be able to get the reference of the line during the click on the "submit" button

  • How to get textframe parent of the current Table?

    Hi all

    I have ITableModel and had ITextModel through ITableTextContainer; through textmodel, I get iframelist. But my question is how can he get the exact relative of the current table textframe?

    Pls suggest on that.

    I got it!

    ITableTextContainer GetAnchorTextIndex().

  • How to get the number of the current frame timeline root to within a clip?

    Hello. I use Adobe Flash pro CS6 and AS3.

    Currently, I am doing so the else inside a video statement.

    It's like that. It is inside a movie clip 'mc_A' on the root.

    If (MovieClip (root) .currentFrame == 1) {}

    trace ("A");

    }

    ElseIf (MovieClip (root) .currentFrame == 100) {}

    trace ('B')

    }

    If I start my swf file, I get a trace message 'A', so if PMT works, but the trace message B will not appear. What should I do so that the else statement works correctly?

    your root timeline will be on frame 100 When this code runs to see 'B '.

  • How to get the week of the current month

    Hi all
    Is it possible to find the week of the current month.

    Help, please...

    Hello...

    Use this feature to get the desired result.

    Hope it's okay...

    CEILING (DAYOFMONTH ("Time D0". "T00 calendar date") (/ 7.00) "

    Note: use 7.00 7 not only in the denominator*.

  • How to get the number of the current slide in Captivate 9?

    With the help of Cap 9.

    Is there a system variable containing the number of the current slide?

    I build a quiz with a drag and drop interaction in the pool of questions. Naturally, the built in Question x of y object is not included, so I have to build a replacement of some sort. Found some old posts on this topic, but the proposed solutions do not seem to work with the current version of Captivate.

    Yes, cpInfoCurrentSlide.

  • How to get the background color of a layer with AE SDK

    Hello

    I try to get the background color for my current layer, but I can't seem to find how do.

    I don't want background color, background color of the application, but the color that shows through, if I set the alpha of my pixels to 0.

    For example, assume that the background of the composition is black, I put a solid top, green then put a picture on top of the solid and apply my pug-in the image.

    If I set the alpha to zero in my plug-in, green solid will be displayed.

    So I want to be able to know that my background is green.

    I tried to use PF_AppGetBgColor(), but which returns the background color of the application, which isn't green in this example.

    If you want more details on what I want to do, I plug P1 which affects some 0-alpha pixels. Above it, I apply an another plugin P2 which reveals alpha-0 pixels by mixing with little color.

    What is happening now is that the output is color of the original image, mixed with the color of P2 (because only modified P1 alpha pixels).

    What I want is to have the color through the transparent pixels of P1 display mixed with the color of P2.

    To do this, I would like to be able to set the color of pixels 0-alpha in the color of the background in P1.

    Sorry for the question long.

    Thanks for your suggestions.

    Hello nicolas.

    If I understand it, that you try to get the buffer of image layers composited under the layer with your effect.

    If that is correct, then I fear that it is almost impossible to do.

    When AE makes a composition he doesn't it down. He's trying to do the opposite in fact.

    Why? because if at some point, the buffer is completely opaque, then he has no need to make what's below.

    further more, checked the diaper changing the rendering order, and many other things affect the rendering of the layers order.

    In addition, there is no API to access buffers intermediaries comp. just the end result.

    the closest you can get than without turning of the world, is to use AEGP_GetCompBGColor().

    that would be useless to you that the image is not composite on that color, unless it is the model being saved to the file.

    so why I said 'almost impossible '?

    You can transform the world.

    You can write a type ECAP 'craftsman '. (look at the example of 'arti')

    These plug-ins make comps (instead of the "advanced3D" converter)

    a craftsman has results intermediaries comp, because he is the one doing the rendering.

    so now you can have your craftsman save the buffer, you need and deliver it to your effect.

    I must warn you that this is very very very difficult.

    Another possible solution is to create a copy of the model resides in your effect,

    erase all the layers that has the image you need and make that reproduces model using AEGP_GetReceiptWorld().

    If you use this method, you must supervise the original model and apply changes to the copy.

    Yes, it's too difficult to do.

    you could make a change in the strategy and apply your effect to an adjustment layer instead.

    the entry for the adjustment layer is the buffer underlying layers.

    Then, you could get the original sources you want to treat using checked layer params.

    the last solution I can think uses the expression of sampleImage() on a hidden parameter.

    This will give you any layer's pixel data in the model, but not the composite of the underlying layers.

    Maybe if you tried sampling adjustment layers post effects... I don't know. you need to try.

    This method is very slow and is also limited to expire, so you can't get a large number of pixels.

    the expression simply fails.

    I hope that this was not all bad news for you.

    Maybe you said more about the plug-in you develop I could come up with a better plan.

    :-)

  • How to get windows 95 PC games to work with windows 7?

    How can I get a game called star wars the phantom menace for PC windows 95 work on my PC whitch is windows 7?

    You can try compatibility mode. http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-compatibility-mode/

    Also have you tried to install just, can work, may not.

    MCP. MCDST. LVL 80

Maybe you are looking for