SQL Queries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sanjayvigil
    New Member
    • Nov 2006
    • 4

    SQL Queries

    I have a table containing ManagerId,Emplo yId,Salary.
    How can I find the manager with maximum number of employees
  • dswethar
    New Member
    • Nov 2006
    • 65

    #2
    Originally posted by sanjayvigil
    I have a table containing ManagerId,Emplo yId,Salary.
    How can I find the manager with maximum number of employees
    Hi,

    Since you haven't specified which sql you are using, I am writing this query in t-sql syntax. Please change it accordingly.

    SELECT TOP 1 ManagerID
    FROM <table>
    GROUP BY ManagerID
    ORDERBY (COUNT(ManagerI D)) DESC

    Comment

    Working...