teniendo tus datos podemos hacer esto:
Código SQL:
Ver originalCREATE TABLE #temp
(
actividad VARCHAR(20),
horario datetime,
total INT
)
INSERT INTO #temp VALUES ('Jugar','04-JUN-2013 11:00:00',2)
INSERT INTO #temp VALUES ('Trabajar','04-JUN-2013 11:00:00',3)
INSERT INTO #temp VALUES ('Trabajar','04-JUN-2013 12:00:00',4)
INSERT INTO #temp VALUES ('Descansar','04-JUN-2013 12:00:00',4)
INSERT INTO #temp VALUES ('Jugar','04-JUN-2013 13:00:00',1)
INSERT INTO #temp VALUES ('Jugar','04-JUN-2013 13:00:00',3)
SELECT #temp.actividad,total,g_total,CAST(total / CAST(g_total AS DECIMAL(10,4)) AS DECIMAL (10,4)) AS porce FROM #temp
LEFT JOIN (SELECT SUM(total) g_total,horario FROM #temp GROUP BY horario) t1
ON (t1.horario=#temp.horario)
saludos!