Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. join query

join query

Scheduled Pinned Locked Moved Database
databasetutorial
4 Posts 4 Posters 12 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13887573
    wrote on last edited by
    #1

    how to find one employee belongs to max dept

    L V M 3 Replies Last reply
    0
    • U User 13887573

      how to find one employee belongs to max dept

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Please think about what your question says. We have no idea what your table structures are, or what fields are associated with an employee record.

      1 Reply Last reply
      0
      • U User 13887573

        how to find one employee belongs to max dept

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        What is "employee"? What is "dept"? What is the relationship between them?

        1 Reply Last reply
        0
        • U User 13887573

          how to find one employee belongs to max dept

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          With as little information as you have supplied this may give you some ideas.

          select *
          from Employee
          where DepartmentID =(
          select top 1 DepartmentID from(
          select DepartmentID , count(*) C
          from Employee
          group by DepartmentID) x order by C desc)

          Never underestimate the power of human stupidity RAH

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups