How to find the cumaltive for a distinct element in the same column

Hello

I wrote the following code,

Select msid, nvl(starttime,0) starttime, sessionvolume, sum (sessionvolume) on sum1 (order by starttime LINES UNBOUNDED PRECEDING)
of aaa_bill;

I have many MSID and I want to calculate the cumaltive for each of them, but my code calculate the MSID cumaltive regardless, sample output like below

Sum1 msid Starttime Sessionvolume
20110809162804-9734-9734 84A8E46E8BD1
20110809162804 45 9779 84A8E46E8BD1
84A8E46E8BD1 20110809162804 2813 12592
84A8E46E8BD1 20110809162804 21111 33703
20110809162804 13253 46956 84A8E46E8BD1
20110809162804 5919 52875 84A8E46E8BD1
5C4CA98EABF3 20110809204555 6149 59024
20110809204555 6739 65763 5C4CA98EABF3
5C4CA98EABF3 20110809204555 2001 67764
5C4CA98EAC00 20110809225314 1080 68844
5C4CA98EAC00 20110809225314 6188 75032

any help please,.

Maybe

select msid,
       nvl(starttime,0) starttime,
       sessionvolume,
       sum(sessionvolume) over(partition by msid order by starttime) sum1
  from aaa_bill

Concerning

Etbin

Tags: Database

Similar Questions

  • How to find the same column name in different tables in the same schema

    Hello

    I find the 'ename' column name in different tables in the same schema.

    Thank you
    Nr

    Hello

    Try this query

    Select column_name, table_name from user_tab_columns where column_name = 'ENAME ';

    Award points and end the debate, if your question is answered or mark if she was...

    Kind regards

    Lacouture.

  • How to find the NULL columns in the table?

    Hello

    Please provide the query to search for null columns in the table. Here, all the rows in the table have same column as null. It will not change.

    Table
    ---------------
    C1 c2 c3 c4
    X C 10
    T D 20

    I want to know that C2 is the nullable column.
    Thanks in advance!

    Kind regards
    Florian...

    A variance more

    create or replace function is_nulled_column(tab varchar2, col varchar2) return varchar2 is
    cnt number:=1;
    begin
      execute immediate 'select count(1) from '||tab||' where '||col||' is not null and rownum=1' into cnt;
      return case when cnt=0 then 'Y' else 'N' end;
    end;
    

    and use:

    select
     c.OWNER,c.TABLE_NAME,c.COLUMN_NAME,c.NULLABLE,is_nulled_column(c.TABLE_NAME,c.COLUMN_NAME) all_nulls
    from all_tab_columns c
    where c.OWNER=user
    and c.TABLE_NAME like '%'
    order by c.OWNER,c.TABLE_NAME,c.COLUMN_ID
    
  • How to find the child level for each table in a relational model?

    Earthlings,

    I need your help, and I know that, "Yes, we can change." Change this thread to a question answered.

    So: How to find the child level for each table in a relational model?

    I have a database of relacional (9.2), all right?
    .
         O /* This is a child who makes N references to each of the follow N parent tables (here: three), and so on. */
        /↑\ Fks
       O"O O" <-- level 2 for first table (circle)
      /↑\ Fks
    "o"o"o" <-- level 1 for middle table (circle)
       ↑ Fk
      "º"
    Tips:
    -Each circle represents a table;
    -Red no tables have foreign key
    -the picture on the front line of tree, for example, a level 3, but when 3 becomes N? How is N? That is the question.

    I started to think about the following:

    First of all, I need to know how to take the kids:
    select distinct child.table_name child
      from all_cons_columns father
      join all_cons_columns child
     using (owner, position)
      join (select child.owner,
                   child.constraint_name fk,
                   child.table_name child,
                   child.r_constraint_name pk,
                   father.table_name father
              from all_constraints father, all_constraints child
             where child.r_owner = father.owner
               and child.r_constraint_name = father.constraint_name
               and father.constraint_type in ('P', 'U')
               and child.constraint_type = 'R'
               and child.owner = 'OWNER') aux
     using (owner)
     where child.constraint_name = aux.fk
       and child.table_name = aux.child
       and father.constraint_name = aux.pk
       and father.table_name = aux.father;
    Thought...
    We will share!

    Thanks in advance,
    Philips

    Published by: BluShadow on April 1st, 2011 15:08
    formatting of code and hierarchy for readbility

    Have you looked to see if there is a cycle in the graph of dependence? Is there a table that has a foreign key to B and B has a back of A foreign key?

    SQL> create table my_emp (
      2    emp_id number primary key,
      3    emp_name varchar2(10),
      4    manager_id number
      5  );
    
    Table created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  create table my_mgr (
      2    manager_id number primary key,
      3    employee_id number references my_emp( emp_id ),
      4    purchasing_authority number
      5* )
    SQL> /
    
    Table created.
    
    SQL> alter table my_emp
      2    add constraint fk_emp_mgr foreign key( manager_id )
      3         references my_mgr( manager_id );
    
    Table altered.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1   select level lvl,
      2          child_table_name,
      3          sys_connect_by_path( child_table_name, '/' ) path
      4     from (select parent.table_name      parent_table_name,
      5                  parent.constraint_name parent_constraint_name,
      6                  child.table_name        child_table_name,
      7                  child.constraint_name   child_constraint_name
      8             from user_constraints parent,
      9                  user_constraints child
     10            where child.constraint_type = 'R'
     11              and parent.constraint_type = 'P'
     12              and child.r_constraint_name = parent.constraint_name
     13           union all
     14           select null,
     15                  null,
     16                  table_name,
     17                  constraint_name
     18             from user_constraints
     19            where constraint_type = 'P')
     20    start with child_table_name = 'MY_EMP'
     21*  connect by prior child_table_name = parent_table_name
    SQL> /
    ERROR:
    ORA-01436: CONNECT BY loop in user data
    

    If you have a cycle, you have some problems.

    (1) it is a NOCYCLE keyword does not cause the error, but that probably requires an Oracle version which is not so far off support. I don't think it was available at the time 9.2 but I don't have anything old enough to test on

    SQL> ed
    Wrote file afiedt.buf
    
      1   select level lvl,
      2          child_table_name,
      3          sys_connect_by_path( child_table_name, '/' ) path
      4     from (select parent.table_name      parent_table_name,
      5                  parent.constraint_name parent_constraint_name,
      6                  child.table_name        child_table_name,
      7                  child.constraint_name   child_constraint_name
      8             from user_constraints parent,
      9                  user_constraints child
     10            where child.constraint_type = 'R'
     11              and parent.constraint_type = 'P'
     12              and child.r_constraint_name = parent.constraint_name
     13           union all
     14           select null,
     15                  null,
     16                  table_name,
     17                  constraint_name
     18             from user_constraints
     19            where constraint_type = 'P')
     20    start with child_table_name = 'MY_EMP'
     21*  connect by nocycle prior child_table_name = parent_table_name
    SQL> /
    
           LVL CHILD_TABLE_NAME               PATH
    ---------- ------------------------------ --------------------
             1 MY_EMP                         /MY_EMP
             2 MY_MGR                         /MY_EMP/MY_MGR
             1 MY_EMP                         /MY_EMP
             2 MY_MGR                         /MY_EMP/MY_MGR
    

    (2) If you try to write on a table and all of its constraints in a file and do it in a valid order, the entire solution is probably wrong. It is impossible, for example, to generate the DDL for MY_EMP and MY_DEPT such as all instructions for a table come first, and all the instructions for the other are generated second. So even if NOCYCLE to avoid the error, you would end up with an invalid DDL script. If that's the problem, I would rethink the approach.

    -Generate the DDL for all tables without constraint
    -Can generate the DDL for all primary key constraints
    -Can generate the DDL for all unique key constraints
    -Can generate the DDL for all foreign key constraints

    This is not solidarity all the DOF for a given in the file object. But the SQL will be radically simpler writing - there will be no need to even look at the dependency graph.

    Justin

  • says that there is an update of firmware available for my 3 t time capsule. I get "an error occurred when downloading". How to find the problem?

    I said that there is an update of the firmware available for my 3 t time capsule. I get the message "an error occurred when downloading". How to find the problem? I have elcapitan 10.11.6 and capsule version 7.7.3

    Try temporarily, connect your MacBook Pro to your Time Capsule using an Ethernet connection... If not already, then try downloading the firmware again.

  • How to find the serial number of the processor in the MacBook pro s serial number? I have a dead MacBook that was given for service to a third party. I doubt that they have replaced the original parts. Help, please. Thank you

    How to find the serial number of the processor in the MacBook pro s serial number? I have a dead MacBook that was given for service to a third party. I doubt that they have replaced the original parts. Help, please. Thank you

    As far as I KNOW, the serial number of the MacBook does not have the serial number of the processor.

  • How to find the value max and min for each column in a table 2d?

    How to find the value max and min for each column in a table 2d?

    For example, in the table max/min for the first three columns would be 45/23, 14/10, 80/67.

    Thank you

    Chuck,

    With color on your bars, you should have enough experience to understand this.

    You're a loop in the table already.  Now you just need a function like table Max and min. loop.  And you may need to transpose the table 2D.

  • How to find the password for my Motorola Wireless?

    How to find the password for my Motorola Wireless?

    How to connect another computer to the Motorola Wireless?

    ... and now my computer won't connect to the wireless...

    Now would be a good time to use the instructions of the Setup Guide quick Motorola SBG940.

    ... I think I'll call my cable provider then!

    It may be better to talk to someone on the phone instead of trying to communicate via typed messages repeated as some of the information in the previous messages typed always seem to be lost in translation.
  • How to find the e-mail address for my HP 6700? Printer shows E-Print connected.

    I am using the Forum to get a new code to the printer and the printer shows homepage that's on, but now I don't know how to find the e-mail address for my computer.

    Hello

    In the front of the printer, go to configuration. Locate and enter the Web Services. Aprove any step to activate the service... leave the system a few minutes to complete your registration, a page will be printed automatically with the code printer and directions to select the email address of hpeprint.com.

    Kind regards.

  • How to find the age of a child and snapshot number snapshot for a virtual machine.

    Hi all

    How to find the age of a snapshot for a virtual machine child count and snapshot.

    This code snippet should help... Assuming that you have the following entries:

    VM (VC:VirtualMachine)

    snapshot (VC:VirtualMachineSnapshot)

    System.log("====== Snapshot details for VM: "+snapshot.config.name+" ======");
    var snapshotTrees = vm.snapshot.rootSnapshotList;
    System.log("Snapshot Tree Count: "+snapshotTrees.length);
    for each (snapshotTree in snapshotTrees){
        showSnapshotInfo(snapshotTree, snapshot);
    }
    
    function showSnapshotInfo(snapshotTree, selectedSnapshot){
        if(selectedSnapshot == snapshotTree.snapshot){
            System.log("====================");
            System.log("Name: "+snapshotTree.name);
            System.log("Id: "+snapshotTree.id);
            System.log("Description: "+snapshotTree.description);
            System.log("createTime: "+snapshotTree.createTime);
            System.log("quiesced: "+snapshotTree.quiesced);
            System.log("replaySupported: "+snapshotTree.replaySupported);
            System.log("backupManifest: "+snapshotTree.backupManifest);
            System.log("snapshot id: "+snapshotTree.snapshot.id);
            System.log("state: "+snapshotTree.state.value);
            var childSnapshotList = snapshotTree.childSnapshotList;
            if(childSnapshotList != null){
                System.log("childSnapshotList length: "+snapshotTree.childSnapshotList.length);
            }
            System.log("");
        }
        if(snapshotTree.childSnapshotList != null){
            System.log("Children found: "+snapshotTree.childSnapshotList.length);
            for each (childSnapshotTree in snapshotTree.childSnapshotList){
                showSnapshotInfo(childSnapshotTree, selectedSnapshot);
            }
        }
    }
    

    During the passage of one of my virtual machines, here is an example of output I get:

    [2014-06-12 15:19:21.493] [I] Snapshot Tree Count: 1
    [2014-06-12 15:19:21.493] [I] ====================
    [2014-06-12 15:19:21.494] [I] Name: before upgrade to 5.0.1
    [2014-06-12 15:19:21.494] [I] Id: 31
    [2014-06-12 15:19:21.494] [I] Description:
    [2014-06-12 15:19:21.495] [I] createTime: Mon Mar 19 2012 13:48:57 GMT-0400 (EDT)
    [2014-06-12 15:19:21.495] [I] quiesced: false
    [2014-06-12 15:19:21.495] [I] replaySupported: null
    [2014-06-12 15:19:21.495] [I] backupManifest: null
    [2014-06-12 15:19:21.496] [I] snapshot id: snapshot-83
    [2014-06-12 15:19:21.496] [I] state: poweredOff
    [2014-06-12 15:19:21.496] [I] childSnapshotList length: 1
    [2014-06-12 15:19:21.496] [I]
    [2014-06-12 15:19:21.497] [I] ====================
    [2014-06-12 15:19:21.497] [I] Name: Before 5.1 upgrade
    [2014-06-12 15:19:21.497] [I] Id: 36
    [2014-06-12 15:19:21.497] [I] Description:
    [2014-06-12 15:19:21.498] [I] createTime: Fri Sep 21 2012 21:59:58 GMT-0400 (EDT)
    [2014-06-12 15:19:21.498] [I] quiesced: false
    [2014-06-12 15:19:21.498] [I] replaySupported: null
    [2014-06-12 15:19:21.498] [I] backupManifest: null
    [2014-06-12 15:19:21.499] [I] snapshot id: snapshot-84
    [2014-06-12 15:19:21.499] [I] state: poweredOff
    [2014-06-12 15:19:21.499] [I] childSnapshotList length: 1
    [2014-06-12 15:19:21.499] [I]
    [2014-06-12 15:19:21.500] [I] ====================
    [2014-06-12 15:19:21.500] [I] Name: Before Named Instance
    [2014-06-12 15:19:21.500] [I] Id: 37
    [2014-06-12 15:19:21.501] [I] Description:
    [2014-06-12 15:19:21.501] [I] createTime: Mon Nov 11 2013 13:40:46 GMT-0500 (EST)
    [2014-06-12 15:19:21.501] [I] quiesced: false
    [2014-06-12 15:19:21.501] [I] replaySupported: null
    [2014-06-12 15:19:21.502] [I] backupManifest: null
    [2014-06-12 15:19:21.502] [I] snapshot id: snapshot-236
    [2014-06-12 15:19:21.502] [I] state: poweredOff
    [2014-06-12 15:19:21.502] [I]
    
  • What is the last level of patch bundle for x 3-2 exadata machine? How to find the doc?

    We have a x 3-2 exadata machine. I have a question: what is the last level of patch bundle for x 3-2 exadata machine? How to find the doc?

    Thanks in advance.

    Check note id 888828.1

    It has all the information you need.

  • How to find the password for the embedded weblogic Server

    How to find the password for the server weblogic shipped from jdeveloper please?

    User, please tell us our jdev version!

    You can't find. Once he lost you can set a new one. For this you can either remove server embedded weblogic (delete the DefaultDomain file in the folder system11.1.1.x.x.x.x.) either you go to the system11.1.1x.xx.x/DefaultDomain/servers/DefaultServer/security folder and open the file boot.properties and delete the encrypted user name and password values and enter the new values for them in normal character. Save the file and restart the integrated server. Connection with the new username and password and it should work.

    The new user name and password are encrypted automatically.

    Timo

  • How to find the latest diagnostics for 11i patches

    How to find the latest patches of diagnostics for 11i, all documents.

    You can find the latest patch in (Note: 167000.1 - Guide of Installation of E-Business Suite Diagnostics).

    You can also check (Note: 235307.1 - E-Business Suite Diagnostics Tools FAQ and Troubleshooting Guide for version 11i and R12).

    Thank you
    Hussein

  • NB200 - how to find the 3G module for it?

    Hello

    Pls how I find the 3G module in my NB200 - PLL20E?

    Thank you

    Hello

    What do you mean exactly?
    You want to upgrade your NB200 with a card 3G?

    If yes then you must make sure that your NB200 could be improved using this card.
    I'm not sure if this is possible.

    But don t give up boyfriend Toshiba authorized service partner in your country could provide details.
    Guys might be able to tell if this is possible and could provide a good 3G module

    If you get more details please share with us!

    See you soon

  • How to find the password for wifi connection?

    I'm trying to connect my iphone to my internet TV. On my phone, it asks me a password to connect to my network TV (different from the wifi network that I connected my TV) and I have no idea how to find the password.

    Hello Pam,.

    Welcome to the community of Sony.

    What is the model # of the TV?

    You can locate the model # of the TV from this link.

    The password has been entered in the iPhone is the WPA password.

    See the following article in the knowledge base to use the Wi - Fi Direct feature with your iPhone.

    https://us.en.KB.Sony.com/app/answers/detail/A_ID/34416

    Please mark it as "acceptable Solution" If you find this information useful.

    Kind regards

    Colby

Maybe you are looking for

  • websites displaying the old html text

    Another laptop I have, running the same version of Windows 8.1 x 64 and FireFox V43, has no problem, display the Web page of variety.com . http://variety.com/2015/film/News/Star-Wars-force-awakens-reviews-premiere-reactions-1201661338/ Web site appea

  • flash player mode disable how vulnerable protected?

    Lastest 38 FF now allows me to easily turn off protected mode FP which seems to heal my FP quite common crashes. The question I have is how vulnerable will I be if protected mode is disabled? I use FF with FP disabled for quite a while now with littl

  • How to move the navigation bar

    I think remember me that the navigation toolbar was directly under the menu bar in previous versions of FF. Mine is now above the bookmarks toolbar. and the bar with open tabs are under the menu bar. I can move the bar to navigate up one level

  • Satellite A200-AH1 does not start problem

    I have this Toshiba Satellite A200 - AH1 laptop computer that will not start. The system has 1 GB of RAM, (2x512MB). When I remove 1 stick, the system starts without a problem, if I replace it, and the other, the laptop boots also upwards. I tested t

  • I'm not a developer. I need Net framework

    I'm running out of disk space.  NET Framework has been installed several years ago, and I can't determine if nothing else I use needs this program.