sum of all the lines before and the line real (11g)

Hello
I would like to know how to summarize the value in a column of all the lines before the actual and real. A simple example

Select the ID of
(
Select rownum, 1 double ID
Union
Select rownum, 2 double
Union
Select rownum, 3 double
Union
Select rownum, 4 double
Union
Select rownum, 5 double
Union
Select rownum, 6 double
Union
Select rownum, 7 double
)

offers

ID
1
2
3
4
5
6
7

and I would have

ID SUM
1 1
2 3
3 6
4 10
5 15
6 21
7 28

Thanks for any help
Best regards

Hello

Here's a way to do it:

with t as
(
select rownum r ,1 ID from dual
union
select rownum,2 from dual
union
select rownum,3 from dual
union
select rownum,4 from dual
union
select rownum,5 from dual
union
select rownum,6 from dual
union
select rownum,7 from dual
)
select id, sum(id) over (order by id) sum
from t ;

        ID        SUM
---------- ----------
         1          1
         2          3
         3          6
         4         10
         5         15
         6         21
         7         28

Kind regards
Sylvie

Tags: Database

Similar Questions

  • The sum of all the "ER" element under the service tag

    Hi gurus

    I'm trying to add up all the values of Er under the tag of benefits. But tag Er resumes on different tags in my document xml, as shown below. can you help me provide how to create the sum for all these Er values under the tag of benefits. I appreciate your help. Here is my xml document.


    < benefits >
    < insurance >
    < REIMBURSED >
    < < /ee > ee > 65
    < > 1000 < /er > er
    < / REIMBURSED >
    < dentalinsurance >
    < < /ee > ee > 65
    < > 1000 < /er > er
    < / dentalinsurance >
    < / insurance >
    < refinementbenefits >
    < socialsecurity >
    < < /ee > ee > 1000
    < > 1000 < /er > er
    < / socialsecurity >
    < c401K >
    < < /ee > ee > 1500
    < > < /er > 1500 St
    < / c401K >
    < / refinementbenefits >
    < timeoffbenefits >
    < holiday >
    < ee > < /ee >
    < > < /er > 1500 St
    < / holiday >
    < sick >
    < ee > < /ee >
    < > < /er > 2200 St
    < / sick >
    < holiday >
    < ee > < /ee >
    < > < /er > 3000 St
    < / holiday >
    < / timeoffbenefits >
    < mandatedbenefits >
    < fedunemp >
    < ee > < /ee >
    < > < /er > 200 er
    < / fedunemp >
    < stunemp >
    < ee > < /ee >
    < > 1000 < /er > er
    < / stunemp >
    < / mandatedbenefits >
    < specialbenefits >
    < freeparking >
    < ee > < /ee >
    < > 1000 < /er > er
    < / freeparking >
    < cell >
    < ee > < /ee >
    < > 1000 < /er > er
    < / mobile phone >
    < education >
    < ee > < /ee >
    < > 1000 < /er > er
    < / education >
    < / specialbenefits >
    < / benefits >

    Hello

    U can try to use

    Thank you.

  • How to get the last row and the sum of all columns in a query

    Hello

    is there a way to get the last record for a column and the sum of all the Archives to another column in the same query.

    Best regards

    You must set your needs correctly volunteers to help here...

    Your data are not good enough to bring you a precise solution. Purpose, you do not have a column, which draws a distinction between the first and the last entry.

    The solution becomes easy based on your design.

    I introduced a grouping called 'id' column and a time column called 'time_of_insert' (only this way you can say with confidence that you can differentiate between the first and last (also a foolproof solution) - you can possibly use sequence (instead of date but if you say that you can insert two lines at the same time) ((and then likely sequence would be a better choice to differentiate instead of a timestamp field) etc...)

    With your sample data, something like this can be done to get the desired results.

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

    WITH dataset AS

    (SELECT 1 id, 10 used, 8 remain, systimestamp + 1/24 time_of_insert FROM DUAL

    UNION ALL

    SELECT the 1 id, 1, 7, systimestamp + 2/24 FROM DUAL

    UNION ALL

    SELECT the id 1, 2, 5, systimestamp + 3/24 FROM DUAL

    UNION ALL

    SELECT 1 id, 1, 0, systimestamp + 4/24 FROM DUAL

    UNION ALL

    SELECT 1 id, 0, 0, systimestamp + 5/24 FROM DUAL

    UNION ALL

    SELECT the 1 id, 1, 4, systimestamp + 6/24 FROM DUAL)

    SELECT *.

    (SELECT SUM (used) ON sum_all)

    FIRST_VALUE (stay)

    COURSES (PARTITION BY id ORDER BY time_of_insert DESC)

    last_row

    Of THE dataset)

    WHERE ROWNUM = 1;

    Output:

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

    SUM_ALL LAST_ROW

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

    15                  4

    See you soon,.

    Manik.

  • Display the sum of all salaries of employees @ footer section

    Hi team,

    I use Jdev 11.1.2.3.0 version.

    I have a requirement where I need to see the sum of all the wages of employees in the employee table footer section in the user interface.

    Is there a declarative approach to this question without using any method Java and master-details relationship.

    Let me know if you need additional information on my problem.

    Thanks in advance,

    Check out ADF - Groovy amounting to Total of a column in a Table. Techartifact that should make your use case.

    Timo

  • I'm retouching of images taken on my iPhone 6 more with Photoshop CS6. I'm doing my color correction and add effects and all that. Before you export the image I review and be sure to what I has no more sharpness and the lines are smooth and it looks good

    I'm retouching of images taken on my iPhone 6 more with Photoshop CS6. I'm doing my color correction and add effects and all that. Before you export the image I review and be sure to what I has no more sharpness and the lines are smooth and it looks good overall. I export it to JPEG, max quality with the establishment of reference standards. I then open the image and it seems fine, as it did in photoshop. My problems begin to occur when I try to download on Twitter as my profile picture. I tried downloading from my office directly on the site via google chrome. When I download the image then begins to have jagged edges and overlooks the tablets. So I thought it was some performance settings, then I tweaked them and restarted a couple of times and still the same result. He would go on my desk but when uploaded to twitter as my profile picture is horrible. So I tried emailing the image of myself and the download through my phone. I opened the image on my iphone and it seemed fine as he did on my desktop but when I downloaded the image it makes then look blurry. I had this problem when downloading photos Twitter via my iphone, so it doesn't surprise me. I have read different forums saying: you must download it from the office, so I thought it would work like this. This could be a problem of twitter than compresses uploaded photos? Other people can do very much the same way, but it does not work for me. Please someone help me before I put my computer in an oven microwave.

    This could be a problem of twitter than compresses uploaded photos?

    Yes. The rest, we can answer. You wrote a lot, but very little discussion. Instead of accurate information you lose yourself in the vague descriptions. Screw color management to the wrong dimensions that trigger resizing server-side it could be any number of things here.

    Mylenium

  • How to quit smoking all the void s vi before resetting digital outputs and then closing

    I have a project that contains a main VI called home screen that calls many different sub vi. I am monitoring for a press of physical button by a digital input with a DAQ Assistant on the main VI and in this case I want my program to abandon all of its VI running and reset all the digital outputs before the closure of Labview. No idea how I would go all this?

    I have attatched the basic model of what I do.

    Joelspider33 wrote:

    The problem is more to do with some of my money that VI running a DAQ Assistant using the same digital lines like the ones I'm wanting to reset and causing it to throw up an error message.

    This is why you must set the DIO AFTER all subVIs are arrested.  And to do this, you must send messages to these subVIs telling them to stop.  If done correctly, it is a very quick process.

  • The sum of all invoices and view total

    Hello

    I do perhaps the hardest way but the case is the following:

    I want to calculate all the Bills of the largeOrders2 collection and collect all the item.totalPrice 'values' in a table and assign a total that I can use on the site, up to now, I have my code as follows:

    {module_data resource = "customers" resourceId = "{{globals.user.entityId}}" subresource = "orders" version = "v3" collection = "largeOrders2" "}

    {% for article on largeOrders2.items-%}

    {% assign invoicetotals = item.totalPrice | round-%} * summarize all invoices as a single total and pass it to a liquid tag

    < span class = "red sumInvoice" > {{invoicetotals}} </span >

    {% endfor}

    < div class = "result" > Total spent on shopping: {capture totalInvoices %} < span class = "totalsum" > < / span > £{% endcapture} {{totalInvoices}} < / div >}

    < script type = "text/javascript" >

    var sum = 0;

    $('.sumInvoice').each (function () {}

    sum += parseFloat ($(this) .text ());  Or this.innerHTML, this.innerText

    $(".totalsum").text (sum);

    });

    < /script >

    use {{totalInvoices}} in a {% if order_requirement < totalinvoices-%} declaration.

    I'm quite sure, there is an easier way, but I have not found a solution for the sum of an array using liquid and obtaining data from the result instead of text().

    Thank you

    You don't need any JavaScript for this and you just need to sort your liquid.

    Things of importance to note:

    -You have a collection and it will be not more then 500 items

    -You create an entitled 'Total' ready before your loop with a value of 0 is a number

    -You do the following your loop for: {% assign invTotal = invTotal: so: item.totalPrice-%}

    - As you loop your value will be added to each invoice

    -{{invTotal}} will give you your total value.

  • Vertical and/or horizontal lines appear in the FSX cockpit at any time during the game. System hangs. Happens all the time.

    I am extremely frustrated by this problem.

    I have FSX and acceleration installed on my system. My system config is: 9450 Intel clocked at 2.67 Ghz on an EVGA 780i motherboard. 1100 watts of power. A graphics card nVidia 8800 GTX, 4 GB of RAM running Windows 7 64 bit. All the drivers, hardware and software are updated. All programs run fine EXCEPT FSX, which is my main game I use.

    V Sync is set to "Power On". FSX loading is correct. When I'm in the cockpit there is a 'sparkling effect' on panels of light from the windows, etc. At any time during the flight, all of a sudden, vertical lines appear, get worse then everything crashes or I have to manually shut down computer. I adjusted and adjusted re all resolutions, uninstalled, reinstalled the program, changed and changed everything and nothing seems to fix the problem. This also occur frequently with add on such as Captain Sim 757, etc.. Captain Sim told me that it was a "matter of Microsoft."

    Help, please!

    Thank you.

    Paul W. Norman

    Hi pauln49,
     
    have a. you been able to play this game earlier on your computer with no problems?
    b. changes made to your computer recently?
    c. do you receive any error messages?

    Check the last update for the game and install it.
    http://www.fsinsider.com

    Also, try the steps outlined in the article.
    http://support.Microsoft.com/kb/303032

    Hope this information is useful.
     
    Umesh P - Microsoft Support

  • I still have not found "help" to tell me how to remove all the lines and columns beyond those needed for my spreadsheet.

    I used several worksheets.  More allows me to specify the rows/columns and then delete them.  This is to remove all the lines/columns beyond those set up and formatted for my spreadsheet.   I tried many ways to remove all additional lines/columns, but without success.  I even took the time to scroll down/on to highlight all the unnecessary lines and columns, but they do not remove it.
    Any suggestions?  I used spreadsheets most allow me to specify the number of rows/columns for my worksheet

    You can ask your question in the office | Excel Forum because it is not really a problem of Windows XP performance and maintenance.

    Office | Excel

    http://answers.Microsoft.com/en-us/Office/Forum/Excel

    Also, providing specific information may help to get a faster response or better, such as the version of Office or Excel? version of Windows XP? Home, Pro, 32-bit or 64-bit.

    I hope this helps.

  • Code 45 for zune. Peripheral USB of States is defective; Windows does not recognize it. This is for XP. It has worked before and nine for Christmas. I have all the updates, etc. My Zune software starts whenever I plugged it to my computer.

    That's my XP OS.  He worked before that date and a new Zune for Christmas, a couple of days.  I have all the updates, etc.  My Zune software starts whenever I plugged it to my computer; now all I get is the error above.
    The zune turn on when connected load, and the system can't recognize not like before.  After troubleshooting, I actually uninstalled the usb and the reinstalled system but said that there is a problem.
    Help!

    Hi, Jason and thanks for your response.  Unfortunately, this was not correct.
    After several tests, including two restarts then stop / restart, I just gave up and let it go... and then, the next day, I retried it, and it worked! I don't really know why, but I have a feeling. While I was working with my zune by itself, I went to albums, shuffle all and then my Zune completely erased, restarted and then played as usual. I think that this reboot of my Zune has helped my system to detect.  What do you think?  Also, I can do the same thing somehow - do a "reboot/reset" my Zune?  In any case, my Zune works perfectly, I really loved and added additional music to today and bought a warranty last night.

  • I have 2 versions of windows vista running on my computer. One is before it crashed and it took all the RAM (Ram)

    I can't clean the discs because I can't load any programs because the memory has faded.  So I can not put a page of my computer desktop or download programs, I need to get my images that I have on the other program running.  I can't open one of these programs because I don't have the authorization even if I was always the user and administrator.  What I would do.  Can I add more memory Ram?  Can I remove the old stuff that I can't open anyway.  DLLs etc.  I downloaded vista 2pr, but it does not work.

    Hello

    Here is the information from your other question here about it:

    "I can't collect any information of my system information page."  When I connect I get redirected to a page that asks me what version of vista I want to open.  One is Microsoft vista and the other is windows vista.  The Microsoft is the only one that works. The other takes me a blank page. »

    "I have 2 versions of windows vista running on my computer. One is before it crashed and it took all the RAM (Ram).

    I suggest that you save your data and reinstall the operating system properly.

    There are several methods to reinstall Vista.

    See what methos works for you.

    There is no Windows Vista downloads available from Microsoft.

    You can contact your computer manufacturer and ask them to send you a set of recovery disks.

    They should do this for a small fee.

    To reinstall Vista using their recovery disk/s, you start from the 1st recovery disk they provide and follow the manufacturer's instructions to reinstall:

    You need to change the Boot order to make the DVD/CD drive 1st in the boot order:

    How to change the Boot order in BIOS:

    http://pcsupport.about.com/od/fixtheproblem/SS/bootorderchange.htm

    "How to replace Microsoft software or hardware, order service packs and replace product manuals.

    http://support.Microsoft.com/kb/326246

    And if you have never received a recovery disk when you bought your computer, there should be a recovery Partition on the hard drive to reinstall Vista on how you purchased your computer.

    The recovery process can be started by pressing a particular combination of the key or keys at startup. (Power on / start)

    Maybe it's F10, F11, Alt + F10, etc., depending on the manufacturer.

    Ask them to the proper key sequence.

    And if you do not score a manufacturer of recovery on your hard drive, you should be able to make your own recovery from her disks to reinstall the operating system.

    Go to programs > name of the manufacturer of your computer > then their system or recovery tools software topics for them, depending on how it is formulated.

    If you can't find any reference to it, contact the manufacturer for advice on how to make these recovery disks.

    Some manufacturers have more available Vista recovery disks.

    If this happens, you may need to try this instead:

    You can also borrow and use a Microsoft Vista DVD, which contains the files for the different editions of Vista (Home Basic, Home Premium, Business and Ultimate) must be installed. The product key on your computer / Laptop box determines what Edition is installed.

    Other manufacturers recovery DVDs are should not be used for this purpose.

    And you need to know the version of 'bit' for Vista, as 32-bit and 64-bit editions come on different DVDs

    Here's how to do a clean install of Vista using a DVD of Vista from Microsoft:

    "How to do a clean install and configure with a full Version of Vista '

    http://www.Vistax64.com/tutorials/117366-clean-install-full-version-Vista.html

    And once the operating system is installed, go to your computer manufacturer's website and get the latest drivers for your particular model or laptop computer.

    And phone Activation may be necessary when you use the above installation method.

    "How to activate Vista normally and by Activation of the phone '

    http://www.Vistax64.com/tutorials/84488-activate-Vista-phone.html

    See you soon.

  • Whenever we start to use our computer, the screen goes black and the message 'Auto adjust is in Prgress'. Then, all of our screen is small and all the icons and pages are smaller than before.

    original title: Auto Adjust

    Hello.

    Whenever we start to use our computer, the screen goes black and the message 'Auto adjust is in Prgress'. Then, all of our screen is small and all the icons and pages are smaller than before.

    I tried restoring the system that works and that gets our screen back to normal but every day that this Auto setting is coming and we can't seem to stop it.

    Any help would be appreciated... Thank you

    Try this:

    Go to the Web site of the manufacturer of your laptop computer-graphics/computer card > drivers and downloads Section > key in your model number > look for the latest Vista drivers > download/install them.

    Then:

    http://Windows.Microsoft.com/en-AU/Windows-Vista/change-screen-resolution

    Change the screen resolution

    Screen resolution refers to the clarity of the text and images on your screen. At higher resolutions, items appear sharper. They appear also smaller, so more items adapted to the screen. At lower resolutions, fewer items adapted to the screen, but they are larger and easier to see. At very low resolutions, however, images may have serrated edges.

    See you soon.

    Mick Murphy - Microsoft partner

  • How to extract all the drives SAS/SATA and Ethernet port speed of the link command line?

    Hello

    Do you know if supports Windows OS built in order to extract all the SAS/SATA drives and ports Ethernet link speed?

    i.e. for SATA3 drive it show 6 Gbps, for DIS3 drive it will show 12 Gbps, to present the current link speed.

    i.e. for Ethernet 10 G, it will show 10 Gbit/s while the current connection speed is at 10 Gbps.

    I need the command to create a batch file to run bike test to check all connection speeds are correct in each cycle the system power runs, if the Windows operating system does not support built in order to achieve this, please send us any tool of 3rd - party with the support of the command line to do this.

    Thanks in advance.

    Jacky

    Hello

    This is a forum for Windows and you can't find the experts here, so your question will better suit in the TechNet forum where members of the community who have the expertise to help you. Check out the link and post your query:

    https://social.technet.Microsoft.com/forums/en-us/f4a3a72b-21e4-45fc-b623-eb1d99215c79/command-prompt-and-bat-files?Forum=w7itprogeneral

  • 20 GB difference between space and the sum of all files

    my c: drive displays of 42.5 GB used space. the sum of all folders on the c: is 22 GB. make all the folders and files not hidden. I just deleted a user account. the files could still be in the cache somewhere? recovery partition is less than 1 GB. Thank you!!

    To study disk space, use download and install Treesize (freeware).
    http://www.Jam-software.com/treesize_free/

    Information about Treesize
    http://www.Jam-software.com/treesize_free/

    When you open Treesize scan select in the Menu and you will see a list of drives. Click on C and it will generate a list of files.

    Display names and 6 larger files sizes and the total at the top of the list.

  • We can add a button to the BP to approve Budget so that it can read all the charges in question cost journal line and auto fill on the grid.

    Hi all

    We can add a button to the BP to approve Budget so that it can read all the charges in question cost journal line and auto fill on the grid.

    Let's say I have a cost with 5 code cost journal

    Code 1 price

    2 cost code

    Code 3 cost

    Code 4 cost

    Code 5 cost

    BP budget approval, after that I click on New, can I add a button to the tab the line items so that when I click on this button, it reads all codes of cost in the cost journal and auto fill on the grid?

    You can create a new 'model' BP for this purpose. Line item type. Then add a line manually with a cost on each code. Then you can use the copy in your BP BA record consolidate the function to copy the line items to the new folder of BP (including all cost codes) into your folder of BA. That is to set up a model record once with all cost codes and then copy consolidate billing it to all lines new record of BA. would this work?

Maybe you are looking for

  • UDS RoutineControl VI a/d converters

    Hello Experts, I use an a/d converters for the automation of the diagonositc of our ECU, I implemented byID read data, write data by ID and a lot more. But geeting a problem in the implementation of Routine inspections. Even if VI that gives no error

  • Vista Home Premium SP2 32-bit

    I had a total of six newspapers of update failed in my VIEW UPDATE HISTORY. I don't know if we should do it, but I know it can be done. I managed to remove a specific "failure" journal there are still five newspapers to update 'Failure' more specific

  • MS Security Bulletin site

    I use Windows XP. I am aware that the monthly KB 890830 is the 'only' XP update be released automatically through Windows Update after April 2014 but I have studied the site Web of the MS Security Bulletin and noticed the hotfix for Windows Server 20

  • Error device Graphice

    Original title: math blaster game Trying to run Math Blaster game on Windows XP and I get this error "error of Graphice device". Please help son that plays at school and I would like to practice math at home to for him. Thank you

  • hp update clock is of the order he gives incorrect times for updates

    I even had a tech fix the main date on the bottom of the desktop, but when I looked at the previous updates that they have been installed at a later date and not the correct date.