Monday, August 4, 2014

Troubling query

This?




SELECT *
FROM Employee e
WHERE EXISTS
(
SELECT 1
FROM Activity
WHERE EmployeeId = e.EmployeeId
GROUP BY EmployeeId
HAVING COUNT(DISTINCT CASE WHEN (ActivityType =1 AND ActivityId = 1581)
OR (ActivityType =7 AND ActivityId = 1300)
THEN ActivityId ELSE NULL
END) = 2
)





Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment