return highest count of grouped field using query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Maiapu
    Contributor
    • Feb 2010
    • 259

    return highest count of grouped field using query

    Hi there please can someone tell me how to create a query that will group a particular field and count the records in that field and return itsrecord with the maximum count..
    The fields are in a single table.

    For example if there were empleename,empt itle,and branch fields in a table and if there were many branches in a department, how can I create a query to return the branch with the highest no of employees.


    Thanks
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Check the GroupBy, Count() and Max() options for a SELECT statement.

    This is really elementary and I would advise to start reading a book about SQL basics.

    Nic;o)

    Comment

    Working...