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

Thread: how to Sort subtotals

  1. #1
    Join Date
    Jan 2010
    Posts
    2

    how to Sort subtotals

    select
    asset_info,month_year,
    sum(incident_total) total_cnt
    from
    reoccuring_incident
    where
    asset_info in (
    select asset_info from
    (
    select asset_info,month_year,
    sum(incident_total) total_cnt
    from reoccuring_incident
    where
    to_date(month_year,'MON-YYYY') = 'DEC-2009'
    GROUP BY asset_info,month_year
    order by total_cnt desc
    )
    where ROWNUM <= :P501_P1_NUMBER_OF_ROWS)
    and to_date(month_year,'MON-YYYY') between add_months(to_date(:P501_START_DATE,'Mon-yyyy'),-3) and to_date(:P501_START_DATE,'Mon-yyyy')
    group by asset_info,month_year


    for the above query following result shows :

    uctvd618 - UNIX Server Oct-09 34
    Sep-09 10
    Total: 44
    uctvp618 - UNIX Virtual Dec-09 33
    Nov-09 14
    Total: 47
    usctap0288 - Windows Server Dec-09 9
    Nov-09 61
    Oct-09 11
    Sep-09 9
    Total: 90


    How to sort "Total : " as desc? ie 90,47,44

    Regards,
    Raj

  2. #2
    Join Date
    Jan 2010
    Posts
    2
    Also month-year column shouldn't get disturbed.. ie order should by Dec,Nov,Oct,Sep.. I try to bring this report using oracle Apex..

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