Results 1 to 4 of 4

Thread: New to SQL - Need help writing a COUNT statement

  1. #1
    Join Date
    Feb 2004
    Location
    Chester, NH
    Posts
    16

    New to SQL - Need help writing a COUNT statement

    Hi all,
    I'm new to SQL and need to write a script that will produce a count of objects for all users. The table is: DBA_objects. I need it grouped by Owner.

    Example:
    OWNER: OBJECT_NAME:
    ABC xxxx
    xxxx
    xxxx
    DEF xxxx
    xxxx

    And a sub-total at the end.

    Any help will be greatly appreciated!
    Regards, Keek
    Last edited by Keek; 02-10-2004 at 05:43 PM.

  2. #2
    Join Date
    Mar 2003
    Location
    NJ
    Posts
    201
    I dont really get your example. Could you be more specific how your table look like and what is sub-total which is for what?

  3. #3
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    you can do

    select owner, count(*)
    from dba_objects
    group by owner

  4. #4
    Join Date
    Feb 2004
    Location
    Chester, NH
    Posts
    16
    Thanks skhanal!
    I sould have been more descriptive, but I am very new to SQl. The actual statement was:
    select owner, OBJECT_TYPE, count(*) from dba_objects group by OWNER, OBJECT_TYPE;

    Thanks for taking the time to help!
    ~Keek

Posting Permissions

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