You were SO close...
SELECT
U.Num,
U.NAME,
[1] = SUM(CASE WHEN MONTH(W.WorkDay) = 1 THEN W.TimeWorked ELSE 0 END),
[2] = SUM(CASE WHEN MONTH(W.WorkDay) = 2 THEN W.TimeWorked ELSE 0 END),
[3] = SUM(CASE WHEN MONTH(W.WorkDay) = 3 THEN W.TimeWorked ELSE 0 END),
[4] = SUM(CASE WHEN MONTH(W.WorkDay) = 4 THEN W.TimeWorked ELSE 0 END),
[5] = SUM(CASE WHEN MONTH(W.WorkDay) = 5 THEN W.TimeWorked ELSE 0 END)
FROM #Users U INNER JOIN #Working W ON U.Num = W.Num
GROUP BY U.Num, U.Name;
You can learn more about this technique (cross tab) at the following link.
http://www.sqlservercentral.com/articles/T-SQL/63681/
And thank you VERY much for the test data setup and the sample code. It made helping you very easy to do. I wish more people would take the small bit of time.
--Jeff Moden
Change is inevitable... Change for the better is not.