Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Posts
    5

    Red face Unanswered: count of "GROUP BY resultset"

    This may be very simple but I am unable to
    figure this out ...

    How do I get the count of the resultset of
    a SQL query which has a GROUP BY clause
    and GROUP by functions.

    For example,
    How do I get the the numbers of rows fetched
    by the following query:


    select asse_no,
    SUM( round(gross_amt + srg + hbt )) as total_outs
    from pls_demand_1
    having SUM(round(gross_amt + srg + hbt )) >80000
    group by asse_no

    In SQL Plus, I see 38 rows fetched.

    BUT ...
    the above query is actually an inner query and this value of count (38) is to be compared to a constant number in the outer query.



    Thanks in advance ...

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: count of "GROUP BY resultset"

    You can:

    SELECT COUNT(*) FROM
    (
    select asse_no,
    SUM( round(gross_amt + srg + hbt )) as total_outs
    from pls_demand_1
    having SUM(round(gross_amt + srg + hbt )) >80000
    group by asse_no
    )

  3. #3
    Join Date
    Dec 2002
    Posts
    5
    Thanks Andrews .... That solved my problem ....

Posting Permissions

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