Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 116643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:12:38+00:00 2026-05-11T03:12:38+00:00

I have a table like this (Oracle, 10) Account Bookdate Amount 1 20080101 100

  • 0

I have a table like this (Oracle, 10)

Account     Bookdate     Amount       1     20080101        100       1     20080102        101       2     20080102        200       1     20080103       -200 ... 

What I need is new table grouped by Account order by Account asc and Bookdate asc with a running total field, like this:

Account     Bookdate     Amount     Running_total       1     20080101        100               100       1     20080102        101               201       1     20080103       -200                 1       2     20080102        200               200 ... 

Is there a simple way to do it?

Thanks in advance.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:12:38+00:00Added an answer on May 11, 2026 at 3:12 am

    Do you really need the extra table?

    You can get that data you need with a simple query, which you can obviously create as a view if you want it to appear like a table.

    This will get you the data you are looking for:

    select      account, bookdate, amount,      sum(amount) over (partition by account order by bookdate) running_total from t / 

    This will create a view to show you the data as if it were a table:

    create or replace view t2 as select      account, bookdate, amount,      sum(amount) over (partition by account order by bookdate) running_total  from t / 

    If you really need the table, do you mean that you need it constantly updated? or just a one off? Obviously if it’s a one off you can just ‘create table as select’ using the above query.

    Test data I used is:

    create table t(account number, bookdate date, amount number);  insert into t(account, bookdate, amount) values (1, to_date('20080101', 'yyyymmdd'), 100);  insert into t(account, bookdate, amount) values (1, to_date('20080102', 'yyyymmdd'), 101);  insert into t(account, bookdate, amount) values (1, to_date('20080103', 'yyyymmdd'), -200);  insert into t(account, bookdate, amount) values (2, to_date('20080102', 'yyyymmdd'), 200);  commit; 

    edit:

    forgot to add; you specified that you wanted the table to be ordered – this doesn’t really make sense, and makes me think that you really mean that you wanted the query/view – ordering is a result of the query you execute, not something that’s inherant in the table (ignoring Index Organised Tables and the like).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Using Oracle) I have a table with key/value pairs like this: create table MESSAGE_INDEX
using a Oracle 10g db I have a table something like this: create table
I have a string from oracle table like this: SELECT col1 FROM MyTable; col1
I have a table in Oracle 10 that is defined like this: LOCATION HOUR
I have a database table like this: id | check_number | amount 1 |
I have data in Oracle table like this format Gname, PBOOK, CNIC, LPNAME, ACRE
I have optimized a complex Oracle statement using temporary table like this : original
I have a table in oracle that looks like this: name | type |
I have a table in an Oracle Database like this ID | LABEL ------------
I have table like this : ID Name_1 Name_2 Name_3 1 Egon Spengler Ives

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.