how can i go about executing these querries using joins?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sekitoleko
    New Member
    • Sep 2006
    • 21

    how can i go about executing these querries using joins?

    Write a query to list:
    all departments that don’t have employees,
    all employees who don’t belong to any department.
  • temat
    New Member
    • Apr 2007
    • 5

    #2
    [all departments that don’t have employees]
    [PHP]Select * From dbo.Departament s
    Where depID NOT IN (SELECT depID FROM dbo.Employees)
    GO[/PHP]

    [ all employees who don’t belong to any department]
    [PHP]Select * From dbo.Employees
    Where depID NOT IN (SELECT depID FROM dbo.Departament s )
    GO[/PHP]

    Comment

    Working...