I have a query and I'm trying to add code so that if the parameter @Client is true then only select records with a Class of either 2 or 6. Else If @Client is false then select All classes. Would you show me what I'm doing wrong?
select workdate, empId, L.LastName + ', ' + L.FirstName AS Name, ManagerUID,
convert(varchar(5), dateadd(second, Total_WorkDate_Units, '0:00:00'),108) as HrsMin,
CASE WHEN @Clients = -1 then L.Class IN (2, 6) END
from Employee_Work_Units_Summary s inner join dbo.EmployeeList L on s.empId = L.EmployeeId
where Total_WorkDate_Units > 32400 AND (L.Suspend = 0) and (ManagerUID = ISNULL(NULLIF (@Supervisor, 0), ManagerUID)) AND (@Employee =0 or L.EmployeeId =@Employee)
Order by workdate, Name]