DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Running total query

  1. #1
    Join Date
    Oct 2011
    Posts
    1

    Running total query

    Thanks in advance for your suggestion and help. When I execute the query below

    select site_id,count (order_id) as ORDCNT
    from itc_com_order_header
    where platform_id='GT'
    group by site_id
    order by ordcnt desc

    RESULT/output

    SITE_ID ORDCNT
    470 1239
    662 491
    581 150

    What I want/expected output
    SITE_ID ORDCNT Running Total
    470 1239 1239
    662 491 1730
    581 150 1880


    How do i do that in ORACLE?

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Either write the output of your first query into a temp table or wrap it up as an inline view; then use sum() analytical function to display running total.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width