Come ho detto nel commento, usa semplicemente un WHERE
. Questa è, ovviamente, un'ipotesi cieca a causa della mancanza di dati di esempio (il campione non ha dati sull'orario di lavoro):
--I prefer CTEs over subqueries
WITH CTE AS(
SELECT s.date_sick,
s.employee_number,
ROW_NUMBER() OVER (PARTITION BY employee_number ORDER BY date_sick) AS rn
FROM dbo.sickness s)
SELECT C.date_sick,
C.employee_number,
DENSE_RANK() OVER (ORDER BY C.employee_number, DATEADD(DAY, -C.rn, C.date_sick)) AS sickness_id,
wh.workinghours
FROM CTE C
JOIN dbo.workinghours wh ON C.employee_number = wh.employee_number
WHERE wh.working_hours > 0
ORDER BY C.employee_number,
C.date_sick;