Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

select number of rows from query

  • 13-06-2007 11:31am
    #1
    Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭


    In sql plus
    How do I get the number of distinct rows of a certain value?

    for example

    select group_number from records group by group_number

    How would I query for the total number of group_numbers in this query?


Comments

  • Registered Users, Registered Users 2 Posts: 23,212 ✭✭✭✭Tom Dunne


    quinnd6 wrote:
    In sql plus
    How do I get the number of distinct rows of a certain value?


    select group_number from records group by group_number

    I'm not sure I am following you.

    Are you looking to count the number of rows returned?

    If so, use the COUNT() function:

    select COUNT(group_number) from records

    or, if you wanted distinct values for group_number:

    select COUNT(DISTINCT(group_number) from records


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    select count(id), group_number from records group by group_number


  • Closed Accounts Posts: 97 ✭✭koloughlin


    If you want distinct ids then you could try

    select group_number, count(distinct id) from records group by group_number


  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    select count(distinct(group_number) from records
    is what I was looking for.
    Thanks


Advertisement