Limiting results to only top ten

  • Hi,

    I have executed the following query and this gives me the issues ordered from hightest frequency to lowest frequency.  However I only want the first ten records.

    How could I change this sub-query to only give the first ten rows, ie the most 10 most frequently occurring issues.

    How can I do this?

    Kind Regards,

    Matthew

     ---------------------------------------------

    select Issue.IssueName, COUNT (Issue.OccasionId)

    from Issue

    group by Issue.IssueName order by 2 desc ;

  • SELECT TOP 10 Issue.IssueName, COUNT(Issue.OccasionID)

    FROM Issue

    GROUP BY Issue.IssueName

    ORDER BY Issue.IssueName DESC


    Kindest Regards,

  • Thanks MrSQL, this worked perfectly.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply