The difficult one

  • hi

    i have 2 tables

    employee : empid,name,salary

    101 , simar,3000

    103, janvi , 5000

    102, dfdfdf, 4500

    emp_dept : empid, dept id dept : deptid name

    101 1

    101 2

    102 3

    103 1

    now i wanna to find record of employee who are part of every department ,but without referencing deptid

    Any idea

    Any idea

  • Assuming you have a unique key on emp_id, dep_id

    SELECT emp_id, COUNT(*) AS CntDep from emp_dept GROUP BY emp_id HAVING COUNT(*) = (SELECT COUNT(*) FROM dbo.Departements)

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

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